Zylann / godot_heightmap_plugin

HeightMap terrain for Godot implemented in GDScript
Other
1.74k stars 159 forks source link

Doesnt work with Navigation Region #389

Open hvlsavo opened 1 year ago

hvlsavo commented 1 year ago

Describe the bug A clear and concise description of what the bug is. While trying to use navigation region i get an error while trying to bake: NavigationMeshSourceGeometryData3D is empty. Parse source geometry first. To Reproduce Steps to reproduce the behavior:

  1. Use Hterrain
  2. Add Navigation Region node
  3. Try to bake navmesh
  4. See error: NavigationMeshSourceGeometryData3D is empty. Parse source geometry first. Linking a reproduction project may help. If you see any errors in the console, that may also help.

Expected behavior A clear and concise description of what you expected to happen. Get a working navigation region Screenshots If applicable, add screenshots to help explain your problem.

Environment

Zylann commented 1 year ago

Mostly same issue as https://github.com/Zylann/godot_heightmap_plugin/issues/335

Navigation is currently not supported out of the box in this plugin. For a very long time Godot didn't offer any way for navigation to detect anything that wasn't composed of straight MeshInstance3D and GridMaps, which were hardcoded in the engine. I'm not sure why Godot manifests such an error, it seems not descriptive enough. But basically the terrain doesn't register to the navigation generation system. For it, terrain is like an empty Node3D. So I guess the error simply means the scene is "empty".

A workaround is to use the generate mesh menu option in the Terrain menu, because then Godot will find it and use it for navigation generation (then the mesh can be deleted afterward).

Since then, I think new APIs were finally added for the terrain to register into and provide geometry, but it still has to get implemented. Until then, the manual method has to be used (which is basically what the automatic method would end up doing), or you may implement the system and try a PR.

Even with this workaround however, it has been seen that the navigation system Godot uses is struggling very hard on large terrains, sometimes even giving up and crashing. That's why there is possibility of lowering the resolution of the mesh, but it might lead to artifacts. So this might still remain to be improved on both sides.