113 lines
6.0 KiB
Plaintext
113 lines
6.0 KiB
Plaintext
[gd_scene format=3 uid="uid://dqvrhiqgkd3w1"]
|
|
|
|
[ext_resource type="PackedScene" uid="uid://dd8wn62anbts8" path="res://core/ai/agents/cow/ai_cow.tscn" id="2_fdj8t"]
|
|
[ext_resource type="PackedScene" uid="uid://mvh2v6v72stt" path="res://core/ai/agents/human/ai_human.tscn" id="2_n3ssi"]
|
|
[ext_resource type="PackedScene" uid="uid://cayakdk7gmlyg" path="res://core/ai/agents/horse/ai_horse.tscn" id="3_fdj8t"]
|
|
[ext_resource type="PackedScene" uid="uid://c2hg6hu2y5srb" path="res://core/ai/agents/pig/ai_pig.tscn" id="4_fj3qp"]
|
|
[ext_resource type="PackedScene" uid="uid://2md4l83fy8kr" path="res://core/ai/agents/pug/ai_pug.tscn" id="5_a3kkd"]
|
|
[ext_resource type="PackedScene" uid="uid://bs1bdtm7jdtgb" path="res://core/ai/agents/sheep/ai_sheep.tscn" id="6_uj4wt"]
|
|
|
|
[sub_resource type="NavigationMesh" id="NavigationMesh_optuv"]
|
|
vertices = PackedVector3Array(10.984741, 0.25012434, -1.0140381, 11.234741, 0.25012434, 0.23596191, 19.484741, 0.25012434, 0.23596191, 19.484741, 0.25012434, -19.514038, 9.234741, 0.25012434, -1.0140381, -19.515259, 0.25012434, -19.514038, -19.515259, 0.25012434, -0.014038086, 8.984741, 0.25012434, -0.014038086, 10.984741, 0.25012434, 1.2359619, 19.484741, 0.25012434, 19.235962, 9.234741, 0.25012434, 1.2359619, -19.515259, 0.25012434, 19.235962)
|
|
polygons = [PackedInt32Array(1, 0, 2), PackedInt32Array(2, 0, 3), PackedInt32Array(6, 5, 4), PackedInt32Array(4, 5, 3), PackedInt32Array(3, 0, 4), PackedInt32Array(4, 7, 6), PackedInt32Array(1, 2, 8), PackedInt32Array(8, 2, 9), PackedInt32Array(6, 10, 11), PackedInt32Array(11, 10, 9), PackedInt32Array(10, 8, 9), PackedInt32Array(6, 7, 10)]
|
|
|
|
[sub_resource type="PlaneMesh" id="PlaneMesh_optuv"]
|
|
|
|
[sub_resource type="BoxShape3D" id="BoxShape3D_xtjak"]
|
|
size = Vector3(1.9942131, 0.09710693, 1.984024)
|
|
|
|
[sub_resource type="BoxMesh" id="BoxMesh_lmjyn"]
|
|
|
|
[sub_resource type="BoxShape3D" id="BoxShape3D_lmjyn"]
|
|
|
|
[sub_resource type="Environment" id="Environment_lmjyn"]
|
|
|
|
[node name="GymAI" type="Node3D" unique_id=868339787]
|
|
|
|
[node name="NavigationRegion3D" type="NavigationRegion3D" parent="." unique_id=774907858]
|
|
navigation_mesh = SubResource("NavigationMesh_optuv")
|
|
|
|
[node name="Floor" type="MeshInstance3D" parent="NavigationRegion3D" unique_id=1976415311]
|
|
transform = Transform3D(20, 0, 0, 0, 20, 0, 0, 0, 20, 0, -0.83473957, 0)
|
|
mesh = SubResource("PlaneMesh_optuv")
|
|
|
|
[node name="StaticBody3D" type="StaticBody3D" parent="NavigationRegion3D/Floor" unique_id=2007477719]
|
|
|
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="NavigationRegion3D/Floor/StaticBody3D" unique_id=1446628130]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.0036563873, -0.009703338, -0.00868988)
|
|
shape = SubResource("BoxShape3D_xtjak")
|
|
|
|
[node name="Obstacle" type="MeshInstance3D" parent="NavigationRegion3D" unique_id=710701082]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10.148018, 0.06508446, 0)
|
|
mesh = SubResource("BoxMesh_lmjyn")
|
|
|
|
[node name="StaticBody3D" type="StaticBody3D" parent="NavigationRegion3D/Obstacle" unique_id=67152580]
|
|
|
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="NavigationRegion3D/Obstacle/StaticBody3D" unique_id=1663742898]
|
|
shape = SubResource("BoxShape3D_lmjyn")
|
|
|
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="." unique_id=1772424900]
|
|
environment = SubResource("Environment_lmjyn")
|
|
|
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="." unique_id=269230449]
|
|
transform = Transform3D(1, 0, 0, 0, 0.17952333, 0.98375374, 0, -0.98375374, 0.17952333, 0, 18.920979, 0)
|
|
|
|
[node name="Control" type="Control" parent="." unique_id=1072240389]
|
|
layout_mode = 3
|
|
anchors_preset = 15
|
|
anchor_right = 1.0
|
|
anchor_bottom = 1.0
|
|
grow_horizontal = 2
|
|
grow_vertical = 2
|
|
|
|
[node name="PanelContainer" type="PanelContainer" parent="Control" unique_id=1647272132]
|
|
layout_mode = 0
|
|
offset_left = 50.0
|
|
offset_top = 50.0
|
|
offset_right = 400.0
|
|
offset_bottom = 827.0
|
|
|
|
[node name="Label" type="Label" parent="Control/PanelContainer" unique_id=272421245]
|
|
custom_minimum_size = Vector2(1, 1)
|
|
layout_mode = 2
|
|
size_flags_vertical = 1
|
|
text = "System Logic:
|
|
- The NPC uses a finite state machine to switch between behaviors.
|
|
- State logic runs during physics updates, while movement is handled by the agent through NavigationAgent3D.
|
|
|
|
AI States:
|
|
- IdleState: The agent waits in place for the duration defined by wait_time.
|
|
- PatrolState: The agent selects a valid random destination and moves toward it.
|
|
|
|
Core Components:
|
|
- NavigationAgent3D: Calculates the path and reports when the destination has been reached.
|
|
- PatrolRadiusShape: Defines the random movement area used when choosing the next patrol point.
|
|
- StateMachine: Initializes the available states and handles transitions between them.
|
|
|
|
Parameters:
|
|
- Speed: Movement speed of the agent.
|
|
- Wait Time: Delay in seconds on the IdleState node.
|
|
- Area Radius: Radius of the SphereShape3D used by PatrolRadiusShape."
|
|
autowrap_mode = 2
|
|
|
|
[node name="AiBase" parent="." unique_id=1166354984 instance=ExtResource("2_n3ssi")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.30116, 0.94226456, 6.322365)
|
|
|
|
[node name="Camera3D" type="Camera3D" parent="." unique_id=1148396057]
|
|
transform = Transform3D(-2.0613477e-08, 0.8818225, -0.47158146, 3.854569e-08, 0.47158146, 0.8818225, 1, -3.5527137e-15, -4.371139e-08, -17.32454, 16.344711, 0)
|
|
|
|
[node name="AiCow" parent="." unique_id=1228675528 instance=ExtResource("2_fdj8t")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -6.127514, 0.94226265, -6.1312685)
|
|
|
|
[node name="AiHorse" parent="." unique_id=2103173512 instance=ExtResource("3_fdj8t")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3.0360618, 0.94226265, 2.8466864)
|
|
|
|
[node name="AiPig" parent="." unique_id=1737929442 instance=ExtResource("4_fj3qp")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7, 1, -2)
|
|
|
|
[node name="AiPug" parent="." unique_id=1080338869 instance=ExtResource("5_a3kkd")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.2930422, 0.9422636, 6.726594)
|
|
|
|
[node name="AiSheep" parent="." unique_id=1308433233 instance=ExtResource("6_uj4wt")]
|
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.684046, 0.7251625, -7.7062917)
|