Hi, I’m spawning enemies on my level and I’m trying to get safe positions on the grid. I’m saying safe because the level has some platforms (all platforms are connected) and enemies can only be spawned on those platforms.
I wrote a method to return a safe position but in some cases the position is out of the grid.
I can’t use constraint to the grid because for some reason agent can’t go up slopes…
This is the method I’m using, am I missing anything?
Vector3 GetClosestPositionOnGraph(Vector3 position, int graph)
constraint = NNConstraint.None;
constraint.graphMask = 1 << graph;
infoPosition = AstarPath.active.GetNearest(position, constraint);