navigation agent added for person

now it goes to new object when it is placed . Also new obj model for person
This commit is contained in:
Nikolai Fesenko
2025-08-15 14:50:15 +02:00
parent 37960fe7f9
commit b7bf4792f3
11 changed files with 393 additions and 17 deletions

View File

@@ -1,10 +1,22 @@
[gd_scene load_steps=2 format=3 uid="uid://ciejie1wil58m"]
[gd_scene load_steps=4 format=3 uid="uid://dqrqq5vg8hek3"]
[ext_resource type="PackedScene" uid="uid://q3xjqni131pt" path="res://Blends/Person/Person.blend" id="1_11yxf"]
[ext_resource type="ArrayMesh" uid="uid://dwd6ylq5xn6kj" path="res://Blends/Person/Person.obj" id="1_11yxf"]
[ext_resource type="Script" uid="uid://d308e5vxshc06" path="res://Scripts/person.gd" id="1_dh77o"]
[node name="Person" type="Node3D"]
[sub_resource type="ConvexPolygonShape3D" id="ConvexPolygonShape3D_dh77o"]
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" parent="." instance=ExtResource("1_11yxf")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.600845)
[node name="Person" type="CharacterBody3D"]
script = ExtResource("1_dh77o")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="Person"]
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0)
mesh = ExtResource("1_11yxf")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
transform = Transform3D(0.3, 0, 0, 0, 0.3, 0, 0, 0, 0.3, 0, 0, 0)
shape = SubResource("ConvexPolygonShape3D_dh77o")
[node name="NavigationAgent3D" type="NavigationAgent3D" parent="."]
avoidance_enabled = true
debug_enabled = true

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=13 format=3 uid="uid://dim2geqhn6d35"]
[gd_scene load_steps=14 format=3 uid="uid://dim2geqhn6d35"]
[ext_resource type="Script" uid="uid://dhls6unflalvd" path="res://Scripts/cart.gd" id="1_esjgi"]
[ext_resource type="ArrayMesh" uid="uid://p3d7iitismhf" path="res://Blends/Cart/cart-bottom.obj" id="1_ux2tx"]
@@ -8,11 +8,14 @@
[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(-10.1323, -0.408406, -1.99609, -10.1323, -0.408406, 3.25391, 10.8677, -0.408406, 3.25391, 10.8677, -0.408406, -1.99609)
polygons = [PackedInt32Array(3, 2, 0), PackedInt32Array(0, 2, 1)]
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(22.012, 1.44263, 6.17651)
size = Vector3(6.47229, 3.39474, 2.33685)
[sub_resource type="BoxShape3D" id="BoxShape3D_u7bw1"]
size = Vector3(22.1814, 0.0957031, 5.72699)
[sub_resource type="BoxShape3D" id="BoxShape3D_esjgi"]
size = Vector3(22.2341, 4.23804, 0.494629)
@@ -36,18 +39,25 @@ cartTop = NodePath("Cart-top")
mesh = ExtResource("1_ux2tx")
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="Cart-bottom"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.195475, 0)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.55366, 0)
navigation_mesh = SubResource("NavigationMesh_ru0md")
[node name="NavigationObstacle3D" type="NavigationObstacle3D" parent="Cart-bottom/NavigationRegion3D"]
vertices = PackedVector3Array(-3.06239, 0, -0.0118253, -8.33663, 0, 0.206487, -8.58355, 0, -2.00176, -2.85335, 0, -2.40343)
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)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cart-bottom/NavigationRegion3D/NavigationObstacle3D/StaticBody3D"]
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.486526, 0)
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cart-bottom/NavigationRegion3D/StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.373695, -0.950567, 0.592163)
shape = SubResource("BoxShape3D_ru0md")
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)

View File

@@ -1,6 +1,7 @@
[gd_scene load_steps=11 format=3 uid="uid://bj7y7q2qkpnci"]
[gd_scene load_steps=12 format=3 uid="uid://bj7y7q2qkpnci"]
[ext_resource type="ArrayMesh" uid="uid://622ethh2pdfa" path="res://Blends/road/road.obj" id="4_jjvhh"]
[ext_resource type="PackedScene" uid="uid://dqrqq5vg8hek3" path="res://Scenes/Prefabs/Person.tscn" id="5_kry3j"]
[ext_resource type="PackedScene" uid="uid://dim2geqhn6d35" path="res://Scenes/Prefabs/cart.tscn" id="6_21xkr"]
[ext_resource type="PackedScene" uid="uid://dy03tqug33fep" path="res://Blends/ground.blend" id="6_344ge"]
[ext_resource type="Script" uid="uid://drrp1k2q71hq2" path="res://Scripts/camera_3d.gd" id="7_6bp64"]
@@ -65,7 +66,7 @@ process_material = SubResource("ParticleProcessMaterial_21xkr")
draw_pass_1 = SubResource("QuadMesh_21xkr")
[node name="SpotLight3D" type="SpotLight3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.64431, 0.764764, 0, -0.764764, 0.64431, -15.9548, 6.86886, -60.5361)
transform = Transform3D(1, 0, 0, 0, 0.64431, 0.764764, 0, -0.764764, 0.64431, -14.3055, 3.48611, -59.8356)
light_energy = 1.162
spot_range = 23.417
spot_angle = 89.99
@@ -111,3 +112,6 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 20.321, 0.384693, -59.426)
[node name="ground2" parent="." instance=ExtResource("6_344ge")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 180.354, 0.385, -59.426)
[node name="Person" parent="." instance=ExtResource("5_kry3j")]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.335692, 3.74189, -60.6947)