[Solved] Quick way to see if richAI can get to target point within a certain distance?


I have a AI system that checks if it can melee attack their target - to do this, I’ve been simply finding the nearest node to the target and checking its distance. This works if the target is off a node (in the air), but doesn’t work if the target is say… on a roof. How do I calculate a richAI path without actually moving on the path, and is there a way to somehow do a quick cheap check as opposed to a full path calculation?

There is IsPathPossible() but that only checks if the target can ‘potentially’ be reached. You can manually search a path in AstarPath if you need to know if it can actually be reached. If your target is on a roof, is it reachable? If so then reachable must mean the shootable distance or something would cover the first distance check too, or not?

In this case, it’s a melee attack, so the character needs to be able to path directly to the target. How do I make a RichAI scan a path without actually going for it?

https://arongranberg.com/astar/docs/astarpath.html -> GetNearest
https://arongranberg.com/astar/docs/abpath.html -> Construct
https://arongranberg.com/astar/docs/astarpath.html -> StartPath

1 Like

Fantastic, I see there’s even a way to force a calculation or attach a delegate!! Thank you!