Hi i encountered a problem,
may not about pathfinding , but it is likely to get help here.
Barracks instantiate creeps to aim position,
and that position may already be occupied by other creeps,
so they overlap , I need below function to avoid this.
public Vector3 GetUncrowdedLocation (Vector3 aimPosition)
How to find closest points that are not crowded and not inside obstacles ?
There is no API for this at the moment, but if you are using the beta you can do this:
var simulator = RVOSimulator.active.GetSimulator() as SimulatorBurst;
var area = simulator.quadtree.QueryArea(circleCenter, circleRadius);
To find the total area of the agents inside the given circle at circleCenter with a radius of circleRadius. So if the area is 0 for example then there are no agents inside (even partially) that circle.
If you are using a recast/navmesh graph you can use
var graph = AstarPath.active.data.recastGraph;
if (graph.PointOnNavmesh(point, null) == null) {
// Not on the navmesh
}