Bullet hit rock detection

This commit is contained in:
2023-09-02 15:58:13 -07:00
parent 11a2554697
commit 549cb7a325
4 changed files with 26 additions and 15 deletions

View File

@@ -19,8 +19,8 @@ Cooldown = 0.5
_projectileSpeed = 15.0
[node name="RigidBody3D" type="RigidBody3D" parent="."]
collision_layer = 2
collision_mask = 0
collision_layer = 18
collision_mask = 16
gravity_scale = 0.0
custom_integrator = true
continuous_cd = true
@@ -41,3 +41,5 @@ shape = SubResource("SphereShape3D_rokeu")
pixel_size = 0.05
axis = 1
texture = ExtResource("2_n5c16")
[connection signal="body_entered" from="RigidBody3D" to="." method="OnBulletHitObject"]

View File

@@ -84,20 +84,24 @@ shape = SubResource("BoxShape3D_sjyl3")
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, -48.9058, -1.95573, -40.25)
shape = SubResource("BoxShape3D_sjyl3")
[node name="Rock1" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.93645, 5.82082, -21.6909)
shape = SubResource("CylinderShape3D_lhgew")
[node name="Rock2" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.82773, 6.46042, -40.6232)
shape = SubResource("CylinderShape3D_fa41j")
[node name="Rock3" type="CollisionShape3D" parent="StaticBody3D"]
transform = Transform3D(0.999841, -0.0178538, 0, 0.0178538, 0.999841, 0, 0, 0, 1, -6.84036, 6.33278, -46.1737)
shape = SubResource("CylinderShape3D_krlem")
[node name="TestEnemy" parent="." instance=ExtResource("3_ds7vi")]
transform = Transform3D(0.998405, 0.0226647, 0.0517184, -0.0544217, 0.630486, 0.77429, -0.0150588, -0.775869, 0.630714, -20.5579, 5.52246, -43.2246)
[node name="SpawnPoint" type="Marker3D" parent="."]
transform = Transform3D(1, 0, 0, 0, 0.5, 0.866025, 0, -0.866025, 0.5, -0.757998, 6.71652, -10.4768)
[node name="StaticBody3D2" type="StaticBody3D" parent="."]
collision_layer = 16
collision_mask = 16
[node name="Rock1" type="CollisionShape3D" parent="StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -7.93645, 5.82082, -21.6909)
shape = SubResource("CylinderShape3D_lhgew")
[node name="Rock2" type="CollisionShape3D" parent="StaticBody3D2"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.82773, 6.46042, -40.6232)
shape = SubResource("CylinderShape3D_fa41j")
[node name="Rock3" type="CollisionShape3D" parent="StaticBody3D2"]
transform = Transform3D(0.999841, -0.0178538, 0, 0.0178538, 0.999841, 0, 0, 0, 1, -6.84036, 6.33278, -46.1737)
shape = SubResource("CylinderShape3D_krlem")

View File

@@ -6,4 +6,9 @@ public partial class TestBullet : Projectile
{
Translate(new Vector3(0, 0, Speed * -(float)delta));
}
private void OnBulletHitObject(Node node)
{
QueueFree();
}
}

View File

@@ -11,7 +11,7 @@ config_version=5
[application]
config/name="GameJam2023"
run/main_scene="res://Scenes/Main.tscn"
run/main_scene="res://Scenes/TestLevel.tscn"
config/features=PackedStringArray("4.1", "C#", "Forward Plus")
[display]