A* Pathfinding Project

3D RVO find empty space for spawn


#1

Hi!

I need to create a units around point. How do I determine that the place of the free? Units without collider.

Maybe there is a function to check the rvo intersections?


#2

Hi

Currently there is no built in method for this, but you can easily loop through the agents and check the distance to them. Something like this:

Vector2 p = new Vector2(transform.position.x, transform.position.z);
RVOSimulator sim = ...; // Set using a reference on the component or something
foreach (var agent in sim.GetSimulator().GetAgents()) {
    var pos = agent.Position;
    // NOTE: IF YOU ARE NOT USING THE BETA YOU NEED THIS CODE INSTEAD
   var pos = new Vector2(agent.Position.x, agent.Position.z);

    if (Vector2.Distance(pos - p) < agent.Radius + ourRadius) {
        // The agent would overlap with another agent
    }
}

#3

Thanks for answer :slight_smile: