Get Simulated movement direction of RVOAgent


Hello I’m using custom physics for my 2D game, and would like to use the RVO feature as a standalone.
I added the RVO Controller+ Simulator/Navmesh as in the example, but i’m having trouble getting the movedir with Local Avoidance taken in account…

so far I’m using something like this to set my velocity.

	void GetPath() {

	void Move(Path p) {
		if (path != null) { path.Release(this); }
		path = p as ABPath;

        Vector2 endMoveDir;
        if (TemporaryForce.magnitude>0.1f) { endMoveDir=TemporaryForce; }
        else { endMoveDir = (dir(path) * moveSpeed) + ExternalForce; }

	    rb.velocity = endMoveDir;

Would expect seeker.StartPath() to take RVO in account but it isn’t.
tried to modify the AIPath a little to see where I could go but no luck after hours.
Basically I just want to simulate the RVO’s path without doing any position updates,
as there’s a lot of custom physics that add to my AI’s movement.

please let me know if there’s any way to get



The Seeker doesn’t care about RVO at all. The seeker only communicates with the pathfinding system, and pathfinding is completely separate from local avoidance.

If you have a RVOController attached you can get the offset it wants to move in a single frame using rvoController.CalculateMovementDelta(Time.deltaTime). Or you can get the velocity using rvoController.velocity.

Note that RVO will work worse if it doesn’t actually move as the local avoidance system thinks it will move. It will still work, but since it cannot as well predict how units are going to move, the avoidance quality may be lower.

The RVOController doesn’t do any movement itself, it only returns which direction it wants to move. Typically the AIPath script does the actual movement (or whatever other movement script you are using).

See also


Thanks for your answer! I got this down and working.However, is there any reason the code above should be generating a ton of garbage each frame?

I tried it with the AIPath script(which doesn’t work for me as I don’t want the movement to be final) but it creates WAY less garbage, and not every frame.


Which code in particular? There are many pieces of code that you might be referring to.


this part specifically… I’m using it in update


Ah. Well, you are calculating a path every single frame, so yeah. That is pretty expensive. You can follow the path for several simulation steps without any issues.
Take a look at