Function PathUtilities.GetPointsAroundPoint

GetPointsAroundPoint (Vector3 center, IRaycastableGraph g, List<Vector3> previousPoints, float radius, float clearanceRadius)

Will calculate a number of points around center which are on the graph and are separated by clearance from each other.

Public Static
void GetPointsAroundPoint (

Vector3

center

The point to generate points around

IRaycastableGraph

g

The graph to use for linecasting. If you are only using one graph, you can get this by AstarPath.active.graphs[0] as IRaycastableGraph. Note that not all graphs are raycastable, recast, navmesh and grid graphs are raycastable. On recast and navmesh it works the best.

List<Vector3>

previousPoints

The points to use for reference. Note that these should not be in world space. They are treated as relative to center. The new points will overwrite the existing points in the list. The result will be in world space, not relative to center.

float

radius

The final points will be at most this distance from center.

float

clearanceRadius

The points will if possible be at least this distance from each other.

)

Will calculate a number of points around center which are on the graph and are separated by clearance from each other.

The maximum distance from center to any point will be radius. Points will first be tried to be laid out as previousPoints and if that fails, random points will be selected. This is great if you want to pick a number of target points for group movement. If you pass all current agent points from e.g the group's average position this method will return target points so that the units move very little within the group, this is often aesthetically pleasing and reduces jitter if using some kind of local avoidance.