- Home /
navmesh remaining distance wrong when destination outside navmesh
Hi,
Currently testing navmesh and agents and I find something odd.
If I set the destination to a position outside the navMesh, the agent stops at the navmesh limit but the remaining distance keeps decreasing until 0... which is wrong visually.
Is this the expected behavior and if so how I detect that an agent actually IS located at the destination. Comparing the position manually? seems odd and an api flag of some sort would be better I feel...
Thanks,
Jean
Thanks,
Jean
Answer by Jakob_Unity · Jan 05, 2012 at 01:26 AM
Hi Jean,
Before acquiring a path the destination point is mapped onto the walkable surface of the navmesh. This end-point (NavMeshAgent.destination) may differ from the world space position you assigned.
NavMeshAgent.remainingDistance is the remaining distance of the path you currently have (or infinite if not known) - not the distance to the world space position argument to the destination.
If the path destination is on a disconnected region of navmesh (with respect to the agent) - the resulting path will have the status "PathPartial"(NavMeshAgent.pathStatus)
the point mapping is actually the same as I had used Nav$$anonymous$$esh.SamplePosition right? So there is no way to actually know where an Agent really is on the path? because I suspect that if several agents are fighting for the same destination their .remainingDistance will also come down to 0 even tho they are because other Agents are bloking. $$anonymous$$aybe I should move this onto a forum thread. http://forum.unity3d.com/threads/118129-Nav$$anonymous$$eshAgent.destination-partialpath-and-actual-progress-of-Agent-along-current-path?p=789893#post789893
Your answer
Follow this Question
Related Questions
Precise distance calculation with high timeScale for NavMeshAgents? 1 Answer
Make Navmesh agent follow closest object with tag 0 Answers
How to detect if NavAgent has reached hit.point? (2) Distance doesn't work? 1 Answer
Find closest "item" object by NavMesh navigation distance performantly 0 Answers
Navmesh Agent get distance 0 Answers