Now About Social Code
summaryrefslogtreecommitdiff
path: root/scripts/bsp_level_generator.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/bsp_level_generator.gd')
-rw-r--r--scripts/bsp_level_generator.gd11
1 files changed, 10 insertions, 1 deletions
diff --git a/scripts/bsp_level_generator.gd b/scripts/bsp_level_generator.gd
index 5d70569..87806e2 100644
--- a/scripts/bsp_level_generator.gd
+++ b/scripts/bsp_level_generator.gd
@@ -123,7 +123,16 @@ func generate_geo(grid: Array[Tile]):
csg_root.add_child(box)
csg_root.use_collision = true
- add_child(csg_root)
+ $NavigationRegion3D.add_child(csg_root)
+
+ # We need to delay baking the nav mesh as
+ # the CSG won't be generated immediately
+ call_deferred("bake_nav")
+
+func bake_nav():
+ print("Baking mesh")
+ $NavigationRegion3D.bake_navigation_mesh(false)
+ print("done baking")
func _ready() -> void:
var starting_axis = randi_range(0, 1)