Support Forum

AI "Stuck" (Will not generate paths) after calling RelocateNodes

Hi.

I am using the “moveable graph” concept, using LocalSpaceRichAI and Localspace graph. This works fine when I scan the initial graph.

However, I want to be able to generate the graph out of view of the player, then move the geometry and the graph into view when it has finished loading.

So, I am doing this, from the documentation:

            var graph = citygraph;// AstarPath.data.recastGraph;
            graph.forcedBoundsCenter = cityworldobj.transform.position;
             var transform = graph.CalculateTransform();
             graph.RelocateNodes(transform);

This seems to work fine, I can see that the graph has moved and is in the correct position, the AI also spawn on the graph, and everything seems ok, except that the AI don’t move, and there are no green and blue lines that indicate that a path has been calculated.

I have tried removing/readding the Localspacerich AI graphs, and modifying any settings that I can find, but the AI just won’t move or generate graphs.

This, like I said, works fine when I don’t move the graph.

Is there something else that I need to do after I call Relocate nodes?

Thanks!

Hi

Hmm, the whole point of the LocalSpaceGraph is so that you won’t have to call RecalculateNodes. Additionally, I think that script might get confused if you move the graph since it might translate the coordinates incorrectly. I’d recommend that use Debug.DrawLine to debug where it calculates that the start and end points of the path should be, and check if those positions are indeed on the graph.