Fix hit detection

This commit is contained in:
2023-09-03 19:40:34 -07:00
parent aa9b5a1793
commit 53d8129cbb
5 changed files with 50 additions and 15 deletions

View File

@@ -1,4 +1,4 @@
[gd_scene load_steps=4 format=3 uid="uid://bt5rolsyjmx55"]
[gd_scene load_steps=5 format=3 uid="uid://bt5rolsyjmx55"]
[ext_resource type="PackedScene" uid="uid://bay1tvgtpfxns" path="res://Scenes/MeleeEnemySchmoove.tscn" id="1_0pxgq"]
[ext_resource type="Script" path="res://Scripts/MeleeEnemy.cs" id="1_50och"]
@@ -6,13 +6,28 @@
[sub_resource type="BoxShape3D" id="BoxShape3D_1nq5h"]
size = Vector3(0.470892, 0.604331, 0.423598)
[sub_resource type="BoxShape3D" id="BoxShape3D_i1yvp"]
size = Vector3(0.470892, 0.604331, 0.423598)
[node name="MeleeEnemyOrb" type="Node3D"]
[node name="CharacterBody3D" type="CharacterBody3D" parent="."]
collision_layer = 0
collision_mask = 0
script = ExtResource("1_50och")
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.475385, 0.143401)
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0840461, 0.475385, 0.143401)
shape = SubResource("BoxShape3D_1nq5h")
[node name="meleeenemy - Updated" parent="CharacterBody3D" instance=ExtResource("1_0pxgq")]
[node name="Area3D" type="Area3D" parent="CharacterBody3D"]
collision_layer = 0
collision_mask = 2
[node name="CollisionShape3D" type="CollisionShape3D" parent="CharacterBody3D/Area3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0840461, 0.475385, 0.143401)
shape = SubResource("BoxShape3D_i1yvp")
[connection signal="body_entered" from="CharacterBody3D/Area3D" to="CharacterBody3D" method="OnHit"]

View File

@@ -14,6 +14,7 @@ radius = 0.704872
height = 1.67894
[node name="Pisces" type="CharacterBody3D" groups=["Player"]]
transform = Transform3D(0.33, 0, 0, 0, 0.33, 0, 0, 0, 0.33, 0, 0, 0)
script = ExtResource("1_tinf8")
_fireProjectile = ExtResource("2_ciujd")
_altFireProjectile = ExtResource("3_0of1i")

View File

@@ -1,10 +1,16 @@
[gd_scene load_steps=4 format=3 uid="uid://bq40xbqibrk1y"]
[gd_scene load_steps=6 format=3 uid="uid://bq40xbqibrk1y"]
[ext_resource type="Script" path="res://Scripts/ShotgunBullet.cs" id="1_binxs"]
[ext_resource type="Texture2D" uid="uid://borp7xvlfdcmq" path="res://Textures/Projectiles/bubble.png" id="2_dv80m"]
[sub_resource type="SphereShape3D" id="SphereShape3D_o6kys"]
radius = 0.2
[sub_resource type="CylinderShape3D" id="CylinderShape3D_eme14"]
radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_752q2"]
radius = 0.3
[sub_resource type="CylinderShape3D" id="CylinderShape3D_ebbqv"]
radius = 0.3
[node name="ShotgunBullet" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.73894, 0)
@@ -23,7 +29,7 @@ contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
shape = SubResource("SphereShape3D_o6kys")
shape = SubResource("CylinderShape3D_eme14")
[node name="Sprite3D" type="Sprite3D" parent="RigidBody3D"]
axis = 1
@@ -40,7 +46,7 @@ contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D2"]
shape = SubResource("SphereShape3D_o6kys")
shape = SubResource("CylinderShape3D_752q2")
[node name="Sprite3D" type="Sprite3D" parent="RigidBody3D2"]
axis = 1
@@ -57,7 +63,7 @@ contact_monitor = true
can_sleep = false
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D3"]
shape = SubResource("SphereShape3D_o6kys")
shape = SubResource("CylinderShape3D_ebbqv")
[node name="Sprite3D" type="Sprite3D" parent="RigidBody3D3"]
axis = 1

View File

@@ -9,8 +9,7 @@ albedo_color = Color(0.584314, 0.0352941, 0.141176, 1)
[sub_resource type="SphereMesh" id="SphereMesh_wuk0e"]
material = SubResource("StandardMaterial3D_phgri")
[sub_resource type="SphereShape3D" id="SphereShape3D_rokeu"]
radius = 0.2
[sub_resource type="CylinderShape3D" id="CylinderShape3D_3c0di"]
[node name="TestBullet" type="Node3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.538645, 0)
@@ -20,7 +19,7 @@ _projectileSpeed = 15.0
[node name="RigidBody3D" type="RigidBody3D" parent="."]
collision_layer = 34
collision_mask = 32
collision_mask = 34
gravity_scale = 0.0
continuous_cd = true
max_contacts_reported = 1000
@@ -34,7 +33,7 @@ skeleton = NodePath("../..")
[node name="CollisionShape3D" type="CollisionShape3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.0054872, -0.00215495, 0.0167444)
shape = SubResource("SphereShape3D_rokeu")
shape = SubResource("CylinderShape3D_3c0di")
[node name="Sprite3D" type="Sprite3D" parent="RigidBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.00168204, -0.0587139, 0)