From 2e33b8e18e7512e53d001ee1aced6c50ddf33068 Mon Sep 17 00:00:00 2001 From: Nikolai Fesenko <152747946+NikolaiFesenko-code@users.noreply.github.com> Date: Fri, 15 Aug 2025 23:01:45 +0200 Subject: [PATCH] navigation mesh changes radius of agents was changed from 0.5 to 0.7 --- Scenes/Prefabs/Person.tscn | 1 + Scenes/Prefabs/cart.tscn | 27 ++++++++++++++------------- Scripts/cart.gd | 5 ++++- 3 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Scenes/Prefabs/Person.tscn b/Scenes/Prefabs/Person.tscn index 6d3532e..f980a2e 100644 --- a/Scenes/Prefabs/Person.tscn +++ b/Scenes/Prefabs/Person.tscn @@ -13,6 +13,7 @@ shader_parameter/shirt_color = Vector3(0, 0, 0) points = PackedVector3Array(0.465296, 4.41226, 2.90193, 0.333481, 5.90986, 1.44973, -0.46535, 4.41226, 2.90193, 0.465296, 2.1221, 2.90193, 0.88668, -1.00046, 1.81769, 0.465296, 4.41226, -1.76192, 0.333481, 5.90986, -0.25128, -0.333667, 5.90986, 1.44973, -0.46535, 4.41226, -1.76192, -0.46535, 2.1221, 2.90193, 0.88668, -1.35832, 1.81769, 0.88668, -1.00046, -0.616956, 0.465296, 2.1221, -1.76192, -0.333667, 5.90986, -0.25128, -0.46535, 2.1221, -1.76192, -0.46535, 1.86882, 1.75606, -0.424191, -1.35832, 1.81769, 0.88668, -1.35832, -0.616956, -0.424191, -1.35832, -0.616956, -0.46535, 1.86882, -0.6165) [node name="Person" type="CharacterBody3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.150706, 0, -0.313651) script = ExtResource("1_dh77o") [node name="MeshInstance3D" type="MeshInstance3D" parent="."] diff --git a/Scenes/Prefabs/cart.tscn b/Scenes/Prefabs/cart.tscn index 8c2f6e0..54450cf 100644 --- a/Scenes/Prefabs/cart.tscn +++ b/Scenes/Prefabs/cart.tscn @@ -8,15 +8,16 @@ [ext_resource type="Shader" uid="uid://bfv6ckihralab" path="res://Shaders/build_transparent.gdshader" id="6_ru0md"] [sub_resource type="NavigationMesh" id="NavigationMesh_ru0md"] -vertices = PackedVector3Array(-8.66035, 3.12619, -1.92166, -8.66035, 3.12619, -0.421665, -2.91035, 3.12619, -0.421665, -2.91035, 3.12619, -1.92166, -2.16035, -0.12381, 0.578335, -9.66035, -0.12381, 0.328335, -9.66035, -0.12381, 2.82834, 11.5896, -0.12381, 2.82834, 11.5896, -0.12381, -1.92166, -1.91035, -0.12381, -1.92166, -8.41035, -0.12381, -1.67166, -8.41035, -0.12381, -0.671665, -3.16035, -0.12381, -0.671665, -3.16035, -0.12381, -1.67166) -polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1), PackedInt32Array(5, 4, 6), PackedInt32Array(6, 4, 7), PackedInt32Array(9, 8, 4), PackedInt32Array(4, 8, 7), PackedInt32Array(13, 12, 10), PackedInt32Array(10, 12, 11)] - -[sub_resource type="BoxShape3D" id="BoxShape3D_ru0md"] -size = Vector3(6.47229, 3.39474, 2.33685) +vertices = PackedVector3Array(-8.52442, 3.10583, -1.86593, -8.52442, 3.10583, -0.615929, -3.27442, 3.10583, -0.615929, -3.27442, 3.10583, -1.86593, -2.27442, 0.105834, 0.884071, -9.27442, 0.105834, 0.884071, -9.27442, 0.105834, 3.13407, 11.4756, 0.105834, 3.13407, 11.4756, 0.105834, -1.86593, -1.77442, 0.105834, -1.86593, -1.77442, 0.105834, 0.384071, -8.27442, 0.105834, -1.61593, -8.27442, 0.105834, -0.865929, -3.52442, 0.105834, -0.865929, -3.52442, 0.105834, -1.61593) +polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1), PackedInt32Array(5, 4, 6), PackedInt32Array(6, 4, 7), PackedInt32Array(10, 9, 8), PackedInt32Array(10, 8, 4), PackedInt32Array(4, 8, 7), PackedInt32Array(14, 13, 11), PackedInt32Array(11, 13, 12)] +agent_radius = 0.7 [sub_resource type="BoxShape3D" id="BoxShape3D_u7bw1"] size = Vector3(22.1814, 0.0957031, 5.72699) +[sub_resource type="BoxShape3D" id="BoxShape3D_ru0md"] +size = Vector3(6.47229, 3.39474, 2.33685) + [sub_resource type="BoxShape3D" id="BoxShape3D_esjgi"] size = Vector3(22.2341, 4.23804, 0.494629) @@ -41,9 +42,16 @@ mesh = ExtResource("1_ux2tx") transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.138559, 0) navigation_mesh = SubResource("NavigationMesh_ru0md") +[node name="ground" type="StaticBody3D" parent="Cart-bottom/NavigationRegion3D"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1.12006, 0.135911, 0.169229, -0.0448687) + +[node name="CollisionShape3D" type="CollisionShape3D" parent="Cart-bottom/NavigationRegion3D/ground"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.930367, -0.452148, 0.568024) +shape = SubResource("BoxShape3D_u7bw1") + [node name="NavigationObstacle3D" type="NavigationObstacle3D" parent="Cart-bottom/NavigationRegion3D"] +height = 0.1 affect_navigation_mesh = true -carve_navigation_mesh = true [node name="StaticBody3D" type="StaticBody3D" parent="Cart-bottom/NavigationRegion3D/NavigationObstacle3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.50052, -0.0203562, -1.1511) @@ -52,13 +60,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5.50052, -0.0203562, -1.1511 transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.352722, 1.07356, -0.102142) shape = SubResource("BoxShape3D_ru0md") -[node name="StaticBody3D" type="StaticBody3D" parent="Cart-bottom/NavigationRegion3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.169229, 0) - -[node name="CollisionShape3D" type="CollisionShape3D" parent="Cart-bottom/NavigationRegion3D/StaticBody3D"] -transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.930367, -0.452148, 0.568024) -shape = SubResource("BoxShape3D_u7bw1") - [node name="Wheels2" type="MeshInstance3D" parent="."] transform = Transform3D(1, 3.49691e-07, 0, -3.49691e-07, 1, 0, 0, 0, 1, -6.05656, -1.694, -2.014) mesh = ExtResource("2_2wj72") diff --git a/Scripts/cart.gd b/Scripts/cart.gd index 7218fb6..c56604f 100644 --- a/Scripts/cart.gd +++ b/Scripts/cart.gd @@ -4,10 +4,13 @@ extends Node3D @export var cartTop: MeshInstance3D @export var mainCamera: Camera3D - +var nav_mesh: NavigationMesh var previewObject var targetPos +func _ready() -> void: + pass + func _input(event: InputEvent) -> void: if event.is_action_pressed("hide_top"): cartTop.visible = !cartTop.visible