Hi, I want to do pathfinding on server. How to export navmesh data include vertices and indices?
Hi
Which graph type are you using?
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));
indicesList.Add(triangleNode.v0);
indicesList.Add(triangleNode.v1);
indicesList.Add(triangleNode.v2);
});
}
Why the index is wrong?
Hi
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?