feat: adjusted collision settings for hitscan weapons

This commit is contained in:
Sara 2025-07-21 23:18:20 +02:00
parent 426a7a8688
commit 97e0c1a79d
3 changed files with 29 additions and 2 deletions

View file

@ -1,9 +1,19 @@
[gd_scene load_steps=3 format=3 uid="uid://snjgu4yp5swd"]
[gd_scene load_steps=5 format=3 uid="uid://snjgu4yp5swd"]
[ext_resource type="PackedScene" uid="uid://ce40pq785yoyi" path="res://objects/weapons/rifle.tscn" id="1_eqqp1"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_bxedw"]
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_eqqp1"]
radius = 0.3173828
[sub_resource type="GDScript" id="GDScript_eqqp1"]
script/source = "extends HealthStatus
func _on_health_changed(remaining: int, delta: int) -> void:
print(\"Player Health Changed:\", delta, \"remaining:\", remaining)
"
[node name="PlayerBody" type="PlayerBody"]
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
@ -21,3 +31,18 @@ fov = 60.0
[node name="WeaponInventory" type="WeaponInventory" parent="."]
unique_name_in_owner = true
starting_weapon = ExtResource("1_eqqp1")
[node name="Hitbox" type="Hitbox" parent="." node_paths=PackedStringArray("health")]
collision_layer = 8
collision_mask = 0
monitoring = false
health = NodePath("../HealthStatus")
[node name="CollisionShape3D" type="CollisionShape3D" parent="Hitbox"]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
shape = SubResource("CapsuleShape3D_eqqp1")
[node name="HealthStatus" type="HealthStatus" parent="."]
script = SubResource("GDScript_eqqp1")
[connection signal="health_changed" from="HealthStatus" to="HealthStatus" method="_on_health_changed"]

View file

@ -22,7 +22,7 @@ bone_idx = 39
unique_name_in_owner = true
transform = Transform3D(1, 0, 0, 0, 0.99999833, -0.0017453281, 0, 0.0017453281, 0.99999833, 1.4540284e-26, 0, 0.027612558)
target_position = Vector3(0, 100, 0)
collision_mask = 2
collision_mask = 6
collide_with_areas = true
spread = 0.003

View file

@ -74,3 +74,5 @@ switch_weapon={
3d_render/layer_2="FirstPerson"
3d_physics/layer_1="General"
3d_physics/layer_2="Precision"
3d_physics/layer_3="Hitbox(Enemy)"
3d_physics/layer_4="Hitbox(Player)"