Local Avoidance in version 3.2

RVO Local Avoidance is progressing. I recently managed to fix a bug which boosted performance hugely. Apparently it is not a good idea to use generic lists for holding simple structs since they will be copied every time they are accessed, and when you do that 170000 times every frame, that small copy operation adds up. Moving to a standard array fixed that. I can now get 5000 agents running around at 50 fps average and 10 fps during calculation steps, the rvo simulation itself is only running at around 10 fps. And this is on my laptop.
I uploaded a new video showing 1000 agents trying to reach their antipodal points on a circle.

So how easy is it to integrate existing movement scripts with the local avoidance then? Really easy actually. I have written an RVOController script which is designed to be an almost drop-in replacement for the Unity CharacterController so starting to use local avoidance will be easy as pie.


  1. Shinrai says:

    What happens when a unit is stationary, does another unit push it away if it’s in the unit’s way? Also is the avoidance in radius? Because if we have a vehicle which is a rectangle and a unit has to go beside it to enter the vehicle, it can’t if the avoidance is in radius.

    • Aron Granberg says:

      The unit will walk to the side if another unit needs to get through. However if you really want them to stay still you can set “static” flag which will disable movement. All units are described as circles (cylinders) at the moment.
      When entering a vehicle, I think you would implement some kind of override logic to turn off the local avoidance and make the unit play some animation when entering it. You can have obstacles which are polygonal though.

      • Mike Budd says:

        Does this mean that if there is a slow moving unit and a fast moving unit both traveling towards the same target that the slower one will move to the side to let the faster one through? Or will the faster unit travel around the slower unit to get to the target? Thanks.

        • Aron Granberg says:

          The faster unit will try to get ahead of the slower unit. Depending on the exact configuration though, it might not be very effective.

  2. xiuxiang chu says:

    I’m eager to learn to Local Avoidance function, if I now to unity3d asset store site to buy, you can send a 3.2 version for me?

  3. Goran says:

    I am very exciting about performance improvement. Local avoider is a nice feature but i can use it on my iOS/Android project because of impact on the frame rate.

  4. Demid Lupin says:

    Is it possible to mark some agents as unmovable(Some kind of buildings for example – Siege tank in starcraft). So without update of NavMesh add local avoidance

    • GeorgeR says:

      Perhaps there could be some metric, like “Yield”, where 0 means an agent won’t move out of anyone’s way, and 1.0 will mean that agent always makes way for another (very polite).

Leave a Reply

Your email address will not be published. Required fields are marked *