Godot 4.5 NavigationMesh baking ignores some obstacles when using runtime chunks and groups

Godot Version

v4.5.1.stable.nixpkgs [f62fdbde1]

Question

Hi, I’m fairly new to Godot, so this might be something obvious I’m missing.

I’m generating world chunks at runtime (similar to Minecraft).
Each chunk contains:

  • a floor

  • several procedurally generated obstacles (walls / pillars)

All objects of a chunk are added to a unique group, and when the chunk loads I create a NavigationRegion3D and bake a NavigationMesh from that group.

The problem is that some obstacles correctly cut holes into the navmesh while others are ignored, even though they use the same scene and colliders.

Note: I tried using one nav-region for all chunks, and it worked but recalculating every new chunk although it already existed whilst moving generated stutters

Here is the relevant code and pictures:

func load():	
	var floor = floor_scene.instantiate()
	floor.add_to_group(nav_group_name)
	add_child(floor)
	
	for child in children:
		child.add_to_group(nav_group_name)
		add_child(child) 
	
	await get_tree().process_frame
	generate_navigation_region()

func generate_navigation_region():
	var nav_region := NavigationRegion3D.new()
	add_child(nav_region)

	await get_tree().physics_frame

	var nav_mesh := NavigationMesh.new()
	nav_mesh.agent_height = 2.0
	nav_mesh.agent_radius = 0.4

	nav_mesh.geometry_parsed_geometry_type = NavigationMesh.PARSED_GEOMETRY_STATIC_COLLIDERS

	nav_mesh.geometry_source_geometry_mode = NavigationMesh.SOURCE_GEOMETRY_GROUPS_WITH_CHILDREN
	
	nav_mesh.geometry_source_group_name = nav_group_name

	nav_region.navigation_mesh = nav_mesh

	nav_region.bake_navigation_mesh(true)
	await nav_region.bake_finished

Obstacle scene structure:

Node3D
└─ StaticBody3D
├─ MeshInstance3D
└─ CollisionShape3D

Thanks for your help, Tom.