I have just recently purchased the pro version of the a* pathfinding project, and I am trying to use it to create a moving/rotating spaceship with AI on board.
So far, I am making some progress. I am using the “moving” example script, and this seems to work ok, but apparently it doesn’t work with node links.
I found this thread:
Which seems to prove this, apparently the Rich AI script doesn’t support the multi-level graphs?
Is this still true? What would be the easiest way to fix this? I have multiple decks/compartments,etc, on my ship object, so I need to be able to use multi-level graphs.
The RichAI movement script is only for navmesh based graphs (i.e. the navmesh and the recast graph). See https://arongranberg.com/astar/docs/movementscripts.html. RichAI works perfectly well with a layered environment when using the recast or navmesh graph.
You are right though that on a moving graph, off mesh links are not yet supported. You could make it work by setting the RichAI.onTraverseOffMeshLink delegate from another script to take control over the link traversal completely however.
Note also that the off mesh links need to be positioned in graph space where the nodes actually are. They cannot move around with the rest of the ship (or at least not without some minor modifications).
Exactly.
So you need to use localSpaceGraph.Transform or localSpaceGraph.InverseTransform for the respective points to transform them from graph space to local space (or vice versa).
It might be better to use the ai.Teleport method which is specifically designed for this use case. It takes care of updating all the internal fields properly.