RichAI is not reaching destination on Teleport

Hi,

I teleport a RichAI agent to a new position in my 3D world. Before calling Teleport, I also set the destination as proposed in documentation. The agent gets teleported and calculates a graph to the new destination. However, it cycles around that new destination and even gets below the set “End Reached Distance” as seen in the screenshot, but the “Reached Destination” flag is not set in that case.

2023-05-15_09-38

if I check
ai.remainingDistance < ai.endReachedDistance
instead of
ai.reachedDestination
it behaves right. So it seems the flag is accidently not set?

Hi

When exactly do you check this? The ai may have to run 1 iteration of its movement calculations to realize it has reached the destination after you teleport it.

Note also that the destination is not considered reached if it is below the agent’s feet or above the agent’s head. The remainingDistance property indicates the distance to the end of the path, but the destination itself may even be outside the navmesh and not reachable at all.

The flag is not set even after hundreds of frames, agent is circling around the destination spot. Might be, that the destination lies abive below a bit. Will check!

Is there an aoption to sample a position to the navmesh as it is with the Unity implementation?

You can get the closest point on the navmesh using AstarPath.active.GetNearest(somePoint).position