Description
This Error Occurs when running the project.
W 0:00:12:0767 TerrainNavigation.gd:52 @ bake(): Source geometry parsing for navigation mesh baking had to parse RenderingServer meshes at runtime.
This poses a significant performance issues as visual meshes store geometry data on the GPU and transferring this data back to the CPU blocks the rendering.
For runtime (re)baking navigation meshes use and parse collision shapes as source geometry or create geometry data procedurally in scripts.
<C++ Source> scene/resources/3d/navigation_mesh_source_geometry_data_3d.cpp:197 @ add_mesh()
TerrainNavigation.gd:52 @ bake()
Navigation.gd:26 @ setup()
Match.gd:86 @ _setup_subsystems_dependent_on_map()
Match.gd:38 @ _ready()
Loading.gd:37 @ _ready()
`func bake(map):
assert(
_navigation_region.navigation_mesh.get_polygon_count() == 0,
"bake() should be called exactly once - during runtime"
)
# setting custom AABB for baking so that height of dynamic AABB is always the same
# - without such setting, re-baking may yield different results depending on geometry height
_navigation_region.navigation_mesh.filter_baking_aabb = AABB(
Vector3.ZERO, Vector3(map.size.x, 5.0, map.size.y)
)
NavigationServer3D.parse_source_geometry_data( # <-- The warning occurs here
_navigation_region.navigation_mesh, _map_geometry, get_tree().root
)
for node in get_tree().get_nodes_in_group("terrain_navigation_input"):
node.remove_from_group("terrain_navigation_input")
NavigationServer3D.bake_from_source_geometry_data(
_navigation_region.navigation_mesh, _map_geometry
)
_sync_navmesh_changes()`
I tried a fix where I only parsed the geometry of a node that is already a collison shape
`func bake(map):
_map_geometry.clear()
_navigation_region.navigation_mesh.filter_baking_aabb = AABB(
Vector3.ZERO, Vector3(map.size.x, 5.0, map.size.y)
)
for node in get_tree().get_nodes_in_group("terrain_navigation_input"):
if node is CollisionShape3D or node is CollisionObject3D:
NavigationServer3D.parse_source_geometry_data(
_navigation_region.navigation_mesh, _map_geometry, node
)
NavigationServer3D.bake_from_source_geometry_data(
_navigation_region.navigation_mesh, _map_geometry
)
_sync_navmesh_changes()`
This (above code) fix fixes the error but then all the entities render in just one corner of the map:
Note: I did not change the rebake, if I change rebake like the fix above it just crashes the game
Without the above bake error fix the game runs fine but lags when spawning a lot of entities
with the fix the game runs without error but you can't do much as in the picture. Thanks :)