Hi, I want to do pathfinding on server

Hi, I want to do pathfinding on server. How to export navmesh data include vertices and indices?



Which graph type are you using?

I used navmesh graph.


    List<Vector3> verticesList = new List<Vector3>();
    List<int> indicesList = new List<int>();

    for (int i = 0; i < AstarPath.active.graphs.Length; ++i)
        NavGraph graph = AstarPath.active.graphs[i];

        graph.GetNodes(node =>
            var triangleNode = node as TriangleMeshNode;

            Int3 a, b, c;
            triangleNode.GetVertices(out a, out b, out c);

            verticesList.Add(new Vector3(a.x, a.y, a.z));
            verticesList.Add(new Vector3(b.x, b.y, b.z));
            verticesList.Add(new Vector3(c.x, c.y, c.z));


Why the index is wrong?

@aron_granberg Please help me!


If you are using a navmesh graph, the source already comes from a mesh. So why do you need to create a graph out of it and then export it again?