Movement disabled question

Hi Aron,
Once my units reach their desired spot ( Vector2.distance ( transform.position , v2desiredSpot) < 0.1f ) , I disable the RVO movement script ( enabled = false; ). The problem that appears shortly after is that other units no longer take the disabled units into consideration, and do not go around them, but instead seem to be pushing into them.
Is there a better way to do this ?


What is it that you want to accomplish? Do you want the units to stop completely, but still make sure other agents do not ignore them? If so you might want to use the RVOController.locked property instead.

Disabling the RVOController component will just make the scripts think you do not want to use local avoidance at all, so they will no longer avoid each other.

Hey Aron,
Thanks for the prompt reply !
If I use controller.locked = true; , I get this.

After some extensive testing - I realized that this (not always but most of the time) happens as well even if I don’t lock the RVOController.

My working “solutions” were as follows :

  1. Once a unit reaches it’s destination, I disable it’s RVOController and it’s RVOMovement scripts. That way, my pass-through unit, just uses physics in order to push the other units away.
  2. Similar to 1) , however, when an allied unit collides (OnCollision2D) with another unit, if the touched unit had the RVO scripts disabled, it enables them - and if the sitting unit was on “guard” ( not “hold position” or “default attacking / focus fire” ) , it will make it find a new random close nearby position, diagonally.
    I’ll keep looking into this, would love a better solution.

The problem with this solution is that once it reaches that spot, if it gets touched again, it will move. So when you have a lot of units, it will cause a recurring chain reaction, and that goes on and on for a long time.


What behavior is it that you want to accomplish ideally? I know what issues you are facing but I don’t really know what you are aiming for.