is there an efficient way to push my agent towards the node underneath it?
My mobile game has elevations such as hills and stairs.
This code produces a lot of overhead (25% of the frame), because it’s done for each character, I have around 25 of them. They just need to stay on navmesh, without any expensive Physics Raycasting.
NNInfo info = AstarPath.active.GetNearest( wanted_nextAi_pos, constraint, _nearest_pathfindNodeHint ); _nearest_pathfindNodeHint = info.node;//update "hint" for more performance during Clamp next time. wanted_nextAI_pos = info.position;
Looking one of such 25 “tails” in more detail, we can see that GetNearest() takes a lot of time, even with a hint:
Currently I am using a simple ABPath.cs, perhaps there is a modifier I could attach?
Or maybe I should inherit from ABPath and override MovementUpdateInternal(). But it looks hard to change, especially that it’s using Velocity2D. How should I adjust it correctly?