Pause seeker's movement if another seeker is in front, resume when unblocked

Hello,

I would like to pause a seeker from continuing on their path, if another seeker is X or less units in front of them. I have not had any luck implementing RVOController (probably because I manually moving seekers through MovementUpdate and FinalizeMovement), but if I am not mistaken, RVO would make seekers walk around each other, not stop and wait until the unit in front stops blocking them.

  1. What is the best way to accomplish this? Should I just check the next node in path and see if there is another seeker on it? Or is there a way to implement this with RVO?

Hi

You could do some raycasting like this perhaps:

void Update () {
    float maxDistance = 1.5f;
    ai.isStopped = Physics.Raycast(transform.position, transform.forward, maxDistance, layerMaskWhichOnlyIncludesOtherAgents);
}

Note that this will not work at all if say two units meet while going in opposite directions, but it will do what you asked for.

2 Likes