Visualizing Navmesh

I upgraded to the latest version (v 3.4.0.5) and I can’t seem to get the recast results visualization to display (the colored diagonal lines on the navmesh). I can only get the navmesh outline to show up, like this in the sample scene ‘RecastExample’:

I found the diagonal lines a lot easier to visualize the results of the recast. Was this removed, or am I just missing how to turn it on?

Hi

This is temporarily left out after a rewrite of some parts of the system. I will add it again soon.

Moving this thread to feature requests.

I would also be interested by another visualization system. I’m a new user, so I never really saw the “diagonal lines” shader except on screenshots, but it seems quite convenient.

I have a temporary workaround for those of you interested: You can export the recast navmesh to a unity mesh and set up the material of your choice with the following C# code:
`
RecastGraph.NavmeshTile[] tiles = recastGraph.GetTiles ();
foreach (RecastGraph.NavmeshTile t in tiles)
{
Mesh mesh = new Mesh();
mesh.name = “tmpNavMesh”;
Vector3[] verts = new Vector3[t.verts.Length];
for (int j=0; j<verts.Length; j++)
verts[j] = (Vector3) t.verts[j];
mesh.vertices = verts;
mesh.triangles = t.tris;

GameObject go = new GameObject("tmpNavMesh");
go.AddComponent<MeshFilter>();
go.AddComponent<MeshRenderer>();			
go.GetComponent<MeshFilter>().mesh = mesh;
go.renderer.material = (Material)Resources.Load ("Materials/navMesh");

}
`

where recastGraph is the recast graph of course. And you’ll need to have the material in the “Resources/Materials” folder. I use it in an editor script. Far from perfect or very elegant, but it does the trick for me!

Don’t hesitate to tell me if I missed something!

Sorry for necroposting, but I too was looking for a way to convert a recast graph into a mesh; so I could have a ground to snap agents to.

Maybe there is a better way, but this works for me:

Just copy the function body to wherever you want.

1 Like