Hi,Fixed this for myself, but it's a very specific case for my game. For anyone wondering: I edited SamplePosition in IAstarAIMovement.cs. I added a check for the proposed position to see if it's inside any given graph my AI is currently on.
https://gyazo.com/9cdab03d9b25668eaae6ba43c8989f16
Kinda ugly, but it works so I'm leaving it as is.
Edit: Also if you're only using 1 graph in your scene, this is much, much easier. Just do:
var direction = transform.InverseTransformDirection(AstarPath.active.GetNearest(position).position - position);
direction.y = 0;
bool isInside = Astar.active.data.<YourGraphType>.PointOnNavMesh(position, NMContraint.None) != null;
if (!isInside)
return false;
return direction.sqrMagnitude < arriveDistance.Value;
In my case I have multiple graphs so I need to do a little extra.
I was trying to implement your method since I also am dealing with multiple traversable graphs.
How did you obtained the second parameter graphIndex value?
Kind regards,
Stefano