0

I'm trying to use the dynamic path-finding API of Unity to implement an indoor-navigation like feature in using a HoloLens.

However, when I call the agent's setDestination method and observe the value of destination in the very next line, the value of agent's destination is incorrect.

enter image description here

Any help will be appreciated.

Kunal Shah
  • 1,071
  • 9
  • 24
  • Where is -1.3,-1.1,1.2? Is it the previously assigned destination, or the current Agent position, or just a random seeming location? – Jethro Apr 23 '18 at 06:26

1 Answers1

0

There's a few funny bits with Setting destination. Calculation of the Path isn't done immediately, it can often take a few frames.

I can see that pathPending is false, but I don't think that necessarily means you have the new destination/path ready.
The docs from pathPending say:

Is a path in the process of being computed but not yet ready? (Read Only)

So maybe if the process of computing the path hasn't even begun yet, it still returns false. And you're still looking at the previous destination?

Try waiting for hasPath to return true instead, and see if it helps.

You could also try just yielding for a few seconds but that's not an ideal way of doing it.

Jethro
  • 3,029
  • 3
  • 27
  • 56
  • I doubt that's the case. The new path may not be ready, but at least the agent's destination should've changed. I major question revolves when I explicitly set the destination in line 43, why does it show a different destination in line 44. – Kunal Shah Apr 22 '18 at 04:32