Precise placement of agent at the end of the path

Hi, I have a situation that I’ve been trying to solve for quite some time now, and I must confess it’s become an exercise in patience. I’m working on a tactical RPG where precise agent placement is paramount, but for some reason my code always misses the target by a small fraction, which ends up placing the RVO agent a little bit after the end point – not only that, actually: since the actor has crossed the end point by a small amount, it rotates to meet the true target point, putting the character into a direction completely different from what was intended.

Narrowing down the possibilities, I found out that the movement doesn’t stop exactly when I say it to stop – it still continues for one or two frames after that. To stop the agent movement I’m doing this:

mRvoController.Move(Vector3.zero);
mRvoController.Teleport(mTargetPosition);

And the agent insists moving a little bit after that.

What should I do to ask the agent to stop and make sure that it will stop at that exact moment, without the extra movement after that? One thing I’ve tried was putting this code inside LateUpdate() instead of Update(), but nothing changed.

(I’m using RVO controllers and NavMesh.)

Thanks and best regards,
Edgard

Hi

You could enable the RVOController.locked field, that will completely prevent it from moving.
You can also try to increase the simulation fps on the RVOSimulator component to make it slightly more accurate, and also disable double buffering to remove the 1 frame latency introduced by it.

See http://arongranberg.com/astar/docs/class_pathfinding_1_1_r_v_o_1_1_r_v_o_controller.php#a18a0f1e6c3d21c252b14ea6ae162e2ff