diff options
author | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-23 19:24:56 +0100 |
---|---|---|
committer | Lucas Fryzek <lucas.fryzek@fryzekconcepts.com> | 2024-09-23 19:25:46 +0100 |
commit | b262d5d194036571d0b3adad3c9914ba9dbe0c8b (patch) | |
tree | 8b2c97809f05450fa7624c811065f0cb6993b2a6 /prefabs | |
parent | b62062c72a2354ba06b53706d94d3db53c224f12 (diff) |
enemy: Add line of sight to AI to look for player
Diffstat (limited to 'prefabs')
-rw-r--r-- | prefabs/enemy.tscn | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/prefabs/enemy.tscn b/prefabs/enemy.tscn index 71e35f8..415b9b8 100644 --- a/prefabs/enemy.tscn +++ b/prefabs/enemy.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=5 format=3 uid="uid://cuad3khwmhnsa"] +[gd_scene load_steps=6 format=3 uid="uid://cuad3khwmhnsa"] [ext_resource type="Script" path="res://scripts/enemy.gd" id="1_aut2k"] @@ -8,6 +8,9 @@ [sub_resource type="CapsuleShape3D" id="CapsuleShape3D_s5qw4"] +[sub_resource type="BoxShape3D" id="BoxShape3D_cyd43"] +size = Vector3(20, 2, 20) + [node name="Enemy" type="CharacterBody3D"] transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.54414, -1.58742) motion_mode = 1 @@ -28,4 +31,15 @@ wait_time = 0.2 [node name="NavigationAgent3D" type="NavigationAgent3D" parent="."] +[node name="VisionVolume" type="Area3D" parent="."] +collision_layer = 4 +collision_mask = 4 +input_ray_pickable = false + +[node name="VisionVolumeShape" type="CollisionShape3D" parent="VisionVolume"] +transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0) +shape = SubResource("BoxShape3D_cyd43") + [connection signal="timeout" from="HitTimer" to="." method="_on_hit_timer_timeout"] +[connection signal="body_entered" from="VisionVolume" to="." method="_on_body_entered"] +[connection signal="body_exited" from="VisionVolume" to="." method="_on_body_exited"] |