I think I learned about Grid Graphs, and now playing with NavMesh Graph, so things turns up not to be intuitive, would you please help me understand:
I have created a simple terrain in blender, cut off the walkable part, so its a separate mesh.
The imported fbx is correct scale and you can see its been placed on the scene without any modifications (0 position, 0 rotation).
Walkable mesh in this case is a child of terrain fbx, which also has nonwalkable rocks and sides.
So when I select this walkable mesh in navmesh graph, its 100x smaller and rotated to 90deg, i tried adjusting offsets as you can see on screenshots, but is there a way just to pick the existing mesh on the scene and use it as navmesh graph with its current position and rotation and scale?
P.S. also after manual adjustments, characters seem to think the edge is a walkable part, not the face.
After re-export with fbx units scale, I only have to change rotation. But still agents behave unexpectedly wrong. All agent are rotated 90 degrees and are walking on the invisble wall with nav mesh. While with grid graph they walk ok.
Still can’t solve it, and hoping for help please.
Here is a video of my workflow:
- I have two meshes in blender - one with full geometry, second is a navmesh
- I export them as two separate fbx, also applying “triangulate” modifier on export
- In unity I add a mesh collider to the navmesh, so objects dont fall through it.
- a star properly generates a navmesh on the asset I provide (visually correct I suppose)
- when trying to move an agent on navmesh it starts walking on a side in the air
You’ll need specific import settings and export settings to make sure the orientation of the mesh is correct.
Essentially you’ll need to ensure that your mesh has the +Y axis as the up axis. If you apply a rotation of 90 degrees to the graph, the characters will also think that they are standing on a very very steep slope, instead of the ground. In blender you can specify which axis should point in which directions in the export. It was a long time since I did it myself, but iirc you should make sure to export from blender with the up=y setting. The graph itself should have no rotation for a standard 3D game in which characters walk mostly in the XZ plane.
Thanks for suggesting the direction to debug, this is undocumented in manual navmesh generating guide though.
Also in my case, I had to export “Z up, -Y Forward”. For some reason. The way you mentioned didn’t work.
I think I’ll be able to buy Pro version next week and switch to Recast graph, just wanted to start programming related logic already and see how units behave on navmesh.
Do you think Recast navmesh generation will understand the walkable paths on such a geometry as in my video? I mean there are some slopes that are meant to be walkable, and some other slopes are nonwalkable.
Or will I potentially have problems generating similar nav mesh, as I built manually?
You can see that there are different heights and some bridges or natural slopes from one height to another height.
If the recast graph doesn’t understand things completely, you can always split those slopes into separate meshes and attach a RecastMeshObj component to them. That allows you to control exactly how the surface should be interpreted (walkable/not walkable/etc).
Your level looks fine. The recast graph should have no trouble with it, I think.