playMaker

Author Topic: NavMesh UpdatePosition  (Read 4074 times)

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
NavMesh UpdatePosition
« on: November 10, 2013, 03:59:53 AM »
Hi community,

In my top-down game, I have static cars that the player can enter from one side, and exit the other side.
When the character enter the car's door trigger he disappear and jump to the other door.

The problem is, it seems,  the character can't jump to the other side of the car, because the area is defined as not walkable in the LayerMasks.

One solution could be to change the LayerMask before the "jump" and reset it after.
The thing is it makes my project quite cluttered and heavy to manage, and I would like a solution that don't use layermasks.

I think the ideal solution might come from the UpdatePosition flag.
But I haven't been able to use successfully.
The UpdatePosition flag should disconnect the Agent from the NavMesh, thus allowing free positioning of the agent, but I don't get it right somehow.

I know it's quite a general question but nobody has been able to help me with that on Unity Answers and it is not well documented in the manual.

Thanks in advance for any insights
Yaniv
« Last Edit: November 10, 2013, 01:12:05 PM by Yanifska »
Visit my portfolio: http://www.yanivcahoua.com/

Splankton

  • Sr. Member
  • ****
  • Posts: 268
Re: NavMesh UpdatePosition
« Reply #1 on: November 10, 2013, 03:26:25 PM »
I'm just throwing this out there as an idea and maybe you've already tried it, but can't you set the property of the navmesh to disable, then get the position of the other side of the car, then set that position to your player then re- enable the navmesh?

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NavMesh UpdatePosition
« Reply #2 on: November 11, 2013, 12:45:15 AM »
Hi,

Have you tried AgentStop action and then move it manually? You get back to it using AgentResume.

bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: NavMesh UpdatePosition
« Reply #3 on: November 11, 2013, 01:52:07 AM »
I have tried all that, the Agent Resume (with stop update as well) move the agent back to its position before the Set Position. I can see my agent jump quickly. I tried to separate the agent stop and agent resume with a next frame event. Didn't help.
What am I missing ?
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NavMesh UpdatePosition
« Reply #4 on: November 11, 2013, 01:57:01 AM »
Hi,

 You should maybe recompute the path instead, but setting the destination again?

bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: NavMesh UpdatePosition
« Reply #5 on: November 11, 2013, 02:38:53 AM »
I do use SetDestinationAsGameObject after the resume action. Maybe I need to use ClaculatePath or ResetPath, or I don't know what  action will recalculate the path with the new position.
I remember I tried those a while ago without success.
I will try again, but with little hope.
Visit my portfolio: http://www.yanivcahoua.com/

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: NavMesh UpdatePosition
« Reply #6 on: November 12, 2013, 02:34:37 AM »
I can't get it working. Have any other idea ?
Visit my portfolio: http://www.yanivcahoua.com/

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: NavMesh UpdatePosition
« Reply #7 on: November 12, 2013, 04:24:06 AM »
Hi,

 Nope... I'll have to see what can be done when I will work on this to update pathFinding support with PlayMaker.

bye,

 Jean

Yanifska

  • Full Member
  • ***
  • Posts: 163
    • My Portfolio
Re: NavMesh UpdatePosition
« Reply #8 on: November 12, 2013, 05:02:41 AM »
I will stay with my LayerMask setup for now, it's kinda' workin'.
Visit my portfolio: http://www.yanivcahoua.com/