Add collision detection

This commit is contained in:
Steven Long
2023-07-19 09:40:16 -07:00
parent f15e1031bd
commit e2bb5ec656
10 changed files with 213 additions and 198 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=18 format=3 uid="uid://bcsgd8vxy43g2"]
[gd_scene load_steps=19 format=3 uid="uid://bcsgd8vxy43g2"]
[ext_resource type="Script" path="res://Scripts/Player.cs" id="1_8dc05"]
[ext_resource type="PackedScene" uid="uid://d20uxkpid4ynd" path="res://Models/vivi1.gltf" id="1_mqt2m"]
@@ -9,6 +9,7 @@
[ext_resource type="Script" path="res://Scripts/NPCFollow.cs" id="4_o5mpp"]
[ext_resource type="Script" path="res://Scripts/DebugText.cs" id="8_ksx3s"]
[ext_resource type="ArrayMesh" uid="uid://35saq7eyk446" path="res://Models/Cookie.obj" id="8_p45nj"]
[ext_resource type="Script" path="res://Scripts/Enemy.cs" id="9_0gfg2"]
[sub_resource type="BoxShape3D" id="BoxShape3D_8verc"]
size = Vector3(100, 2, 100)
@@ -116,22 +117,27 @@ material_override = SubResource("StandardMaterial3D_ultw4")
use_collision = true
size = Vector3(15.0266, 4.74018, 1)
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
collision_layer = 0
collision_mask = 16
[node name="Cookie" type="MeshInstance3D" parent="CharacterBody3D"]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -8.04457, -0.130408, -1.66095)
mesh = ExtResource("8_p45nj")
skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -8.04457, 0.690081, -1.66095)
shape = SubResource("CapsuleShape3D_y33ih")
[node name="DebugUI" type="Node2D" parent="."]
[node name="TextEdit" type="TextEdit" parent="DebugUI"]
offset_right = 3468.0
offset_bottom = 777.0
script = ExtResource("8_ksx3s")
[node name="RigidBody3D" type="RigidBody3D" parent="."]
collision_layer = 0
collision_mask = 17
max_contacts_reported = 10
contact_monitor = true
script = ExtResource("9_0gfg2")
[node name="Cookie" type="MeshInstance3D" parent="RigidBody3D"]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -8.04457, -0.130408, -1.66095)
mesh = ExtResource("8_p45nj")
skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
transform = Transform3D(0.2, 0, 0, 0, 0.2, 0, 0, 0, 0.2, -8.04457, 0.690081, -1.66095)
shape = SubResource("CapsuleShape3D_y33ih")
[connection signal="body_entered" from="RigidBody3D" to="RigidBody3D" method="OnHit"]