Connecting recast graphs at runtime

Hi, I’m working on 16km2 open world with multiple recast graph and using Realistic Car Controller (physic movement) The vehicle has Seeker with Funnel and Smooth modifiers. I have a problem with moving between contacting graphs. I’m checking IsPathPossible and if not I’m connecting closest nodes with GraphNode.Connect in a WorkItem. Nodes connect but in a weird way, that makes my vehicle unable to physically follow the path. The connection looks like it’s parallel not perpendicular to the graph edge.
I’m connecting nodes:
startNeighbor = startNode.Graph.GetNearest(end).node;
endNeighbor = endNode.Graph.GetNearest(start).node;
start node is where path starts and end node where is the end point of path

The cyan line is the connection, green line is the path, darker line is where graphs meet. I want to move forward, the funnel should make it straight, right?

What I am doing wrong?


Connecting two graphs like that is usually not recommended. Is there a reason you cannot have a single graph?

What is the recommended way of connecting them?
I made one graph for one terrain and I have lots of them. It’s easier to work with a graph that exists only where it should be, recalculations should be faster too. I load and unload graphs and terrains only near the player. The world is quite big (16km2) and may be bigger in the future

You could use the NavmeshPrefab - A* Pathfinding Project component
Or alternatively the ProceduralGraphMover - A* Pathfinding Project

1 Like