public void FindNearest(T target) { target.neighbourAgents.Clear(); target.neighbourSqrDistances.Clear(); float radius = target.maxRadius; float radisuSqr = SomeMath.Sqr(radius); Vector2 pos = target.position; Bounds2D targetBounds = new Bounds2D(pos.x, pos.y, radius); SearchRecursive(target, targetBounds, pos, radisuSqr, root); }
public static void FindNearestAgent(PathFinderAgent agent) { if (agent.updateNeighbourAgents == false) { return; } agent.neighbourAgents.Clear(); agent.neighbourSqrDistances.Clear(); float radius = agent.maxNeighbourDistance; float radisuSqr = SomeMath.Sqr(radius); Vector3 pos = agent.positionVector3; Bounds2D targetBounds = new Bounds2D(pos.x, pos.z, radius); SearchRecursive(agent, targetBounds, pos, radisuSqr, root); }