Skip to content

Commit

Permalink
Add terrain navigation improvements and reenable runtime baking
Browse files Browse the repository at this point in the history
  • Loading branch information
Scony committed Aug 26, 2024
1 parent 21cba83 commit e121442
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 14 deletions.
1 change: 1 addition & 0 deletions project.godot
Original file line number Diff line number Diff line change
Expand Up @@ -215,4 +215,5 @@ locale/translations=PackedStringArray("res://assets/translations/match.en.transl

[navigation]

3d/merge_rasterizer_cell_scale=0.001
3d/use_edge_connections=false
1 change: 0 additions & 1 deletion source/FeatureFlags.tscn
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

[node name="FeatureFlags" type="Node"]
script = ExtResource("1_wihie")
allow_navigation_rebaking = false
god_mode = true
15 changes: 2 additions & 13 deletions source/match/TerrainNavigation.gd
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,8 @@ func _rebake():
NavigationServer3D.parse_source_geometry_data(
_navigation_region.navigation_mesh, full_geometry, get_tree().root
)

# add pre-parsed map geometry manually
# TODO: get rid of it when NavigationServer3D.parse_source_geometry_data() adds `append` param
var new_indices = full_geometry.get_indices()
var original_indices_num = new_indices.size()
var new_vertices = full_geometry.get_vertices()
var original_vertices_num = new_vertices.size()
new_indices.append_array(_map_geometry.get_indices())
new_vertices.append_array(_map_geometry.get_vertices())
for i in range(original_indices_num, new_indices.size()):
new_indices[i] += original_vertices_num / 3
full_geometry.set_indices(new_indices)
full_geometry.set_vertices(new_vertices)
# add pre-parsed map geometry
full_geometry.merge(_map_geometry)

NavigationServer3D.bake_from_source_geometry_data_async(
_navigation_region.navigation_mesh, full_geometry, _on_bake_finished
Expand Down

0 comments on commit e121442

Please sign in to comment.