So I’m building a graph out of the vertices and indices returned from NavMesh.CalculateTriangulation, which I’m using in a java based A* pathfinding library. But I think there is something I’m doing wrong. The paths being generated on the server basically have the x and z coordinates swapped.
Each node in my graph has a vertex, and an array of all other vertices it is connected to. I build it like so. Pseudo code.
// Build nodes first out of vertices
foreach vertex in vertices
create node with position as vertex
foreach node
foreach triangle in mesh
if node vertex equals one of the triangle vertices, add the two triangle vertices that are not me as connected vertices
The graph is very simple, with a method that takes a node, and returns all connected nodes. This is used by the pathfinder. The heuristic is just a distance calculation between two nodes.
There is something I’m missing here but I’m just not seeing it.