diff --git a/project.godot b/project.godot index b65d8fb..3ef8fdb 100644 --- a/project.godot +++ b/project.godot @@ -211,6 +211,7 @@ locale/translations=PackedStringArray("res://assets/translations/match.en.transl 3d_physics/layer_1="Terrain" 3d_physics/layer_2="TerrainObjects" 3d_physics/layer_3="AirObjects" +3d_physics/layer_4="Air" [navigation] diff --git a/source/match/AirNavigation.gd b/source/match/AirNavigation.gd index 56722f0..0db1abc 100644 --- a/source/match/AirNavigation.gd +++ b/source/match/AirNavigation.gd @@ -4,7 +4,7 @@ extends Node3D @onready var navigation_map_rid = NavigationServer3D.map_create() @onready var _navigation_region = find_child("NavigationRegion3D") -@onready var _reference_mesh = find_child("ReferenceMesh") +@onready var _reference_static_collider_shape = find_child("CollisionShape3D") func _ready(): @@ -16,7 +16,7 @@ func _ready(): NavigationServer3D.region_set_map(_navigation_region.get_region_rid(), navigation_map_rid) NavigationServer3D.map_force_update(navigation_map_rid) NavigationServer3D.map_set_active(navigation_map_rid, true) - _reference_mesh.global_transform.origin.y = Constants.Match.Air.Y + _reference_static_collider_shape.global_transform.origin.y = Constants.Match.Air.Y func bake(map): @@ -24,10 +24,11 @@ func bake(map): _navigation_region.navigation_mesh.get_polygon_count() == 0, "bake() should be called exactly once - during runtime" ) - var plane_mesh = PlaneMesh.new() - plane_mesh.size = map.size - plane_mesh.center_offset = Vector3(map.size.x, 0, map.size.y) / 2.0 - _reference_mesh.mesh = plane_mesh + var shape = BoxShape3D.new() + shape.size = Vector3(map.size.x, 0, map.size.y) + _reference_static_collider_shape.shape = shape + _reference_static_collider_shape.global_transform.origin.x = map.size.x / 2.0 + _reference_static_collider_shape.global_transform.origin.z = map.size.y / 2.0 _navigation_region.bake_navigation_mesh(false) diff --git a/source/match/Match.tscn b/source/match/Match.tscn index d6f2ffb..c134f5a 100644 --- a/source/match/Match.tscn +++ b/source/match/Match.tscn @@ -84,7 +84,8 @@ flip_faces = true size = Vector2(2, 2) [sub_resource type="NavigationMesh" id="NavigationMesh_8emvl"] -geometry_source_geometry_mode = 2 +geometry_parsed_geometry_type = 1 +geometry_source_geometry_mode = 1 geometry_source_group_name = &"air_navigation_input" cell_size = 0.4 cell_height = 0.4 @@ -220,9 +221,14 @@ script = ExtResource("10_1wfp1") [node name="Air" type="Node3D" parent="Navigation"] script = ExtResource("16_ravsv") -[node name="ReferenceMesh" type="MeshInstance3D" parent="Navigation/Air" groups=["air_navigation_input"]] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) +[node name="ReferenceStaticCollider" type="StaticBody3D" parent="Navigation/Air" groups=["air_navigation_input"]] visible = false +collision_layer = 8 +collision_mask = 0 +input_ray_pickable = false + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Navigation/Air/ReferenceStaticCollider"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.5, 0) [node name="NavigationRegion3D" type="NavigationRegion3D" parent="Navigation/Air"] navigation_mesh = SubResource("NavigationMesh_8emvl")