Fixed shell casing collision, sound and made the shells fade out rather than disappear
parent
e5cd4bd1f9
commit
ab0cdf6868
|
@ -10,9 +10,8 @@ extends RigidDynamicBody3D
|
|||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
var mat = $Casing/Casing_LOD0.get_active_material(0).duplicate()
|
||||
$Casing/Casing_LOD0.set_surface_override_material(0, mat)
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
#func _process(delta):
|
||||
|
@ -20,7 +19,7 @@ func _ready():
|
|||
|
||||
|
||||
func _on_Timer_timeout():
|
||||
queue_free()
|
||||
$AnimationPlayer.play("Fade")
|
||||
|
||||
func _on_Casing_body_entered(body):
|
||||
var vel = linear_velocity.length()
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://dfwe3bvh8lbbp"]
|
||||
[gd_scene load_steps=7 format=3 uid="uid://dfwe3bvh8lbbp"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://b6aa41e8u5cxi" path="res://Assets/Weapons/Handgun/Casing.gltf" id="1"]
|
||||
[ext_resource type="Script" path="res://Assets/Weapons/Handgun/Casing.gd" id="1_kwgjj"]
|
||||
|
@ -8,7 +8,142 @@
|
|||
radius = 0.0119513
|
||||
height = 0.0560047
|
||||
|
||||
[sub_resource type="Animation" id="Animation_euct2"]
|
||||
resource_name = "Fade"
|
||||
length = 3.0
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Casing_LOD0:surface_material_override/0:transparency")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [1]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Casing_LOD0:surface_material_override/0:albedo_color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0, 3),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 0,
|
||||
"values": [Color(0.905882, 0.701961, 0.309804, 1), Color(0.905882, 0.701961, 0.309804, 0)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Casing_LOD0:surface_material_override/0:depth_draw_mode")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [1]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("Casing_LOD0:surface_material_override/0:cull_mode")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [0]
|
||||
}
|
||||
tracks/4/type = "method"
|
||||
tracks/4/path = NodePath("..")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(3),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"values": [{
|
||||
"args": [],
|
||||
"method": &"queue_free"
|
||||
}]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_u4pct"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/path = NodePath("Casing_LOD0:mesh:surface_1/material:transparency")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/path = NodePath("Casing_LOD0:mesh:surface_1/material:albedo_color")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [Color(0.906332, 0.703778, 0.309292, 1)]
|
||||
}
|
||||
tracks/2/type = "value"
|
||||
tracks/2/path = NodePath("Casing_LOD0:mesh:surface_1/material:depth_draw_mode")
|
||||
tracks/2/interp = 1
|
||||
tracks/2/loop_wrap = true
|
||||
tracks/2/imported = false
|
||||
tracks/2/enabled = true
|
||||
tracks/2/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1]
|
||||
}
|
||||
tracks/3/type = "value"
|
||||
tracks/3/path = NodePath("Casing_LOD0:mesh:surface_1/material:cull_mode")
|
||||
tracks/3/interp = 1
|
||||
tracks/3/loop_wrap = true
|
||||
tracks/3/imported = false
|
||||
tracks/3/enabled = true
|
||||
tracks/3/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [0]
|
||||
}
|
||||
tracks/4/type = "value"
|
||||
tracks/4/path = NodePath("Casing_LOD0:surface_material_override/0:transparency")
|
||||
tracks/4/interp = 1
|
||||
tracks/4/loop_wrap = true
|
||||
tracks/4/imported = false
|
||||
tracks/4/enabled = true
|
||||
tracks/4/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 0,
|
||||
"values": [1]
|
||||
}
|
||||
|
||||
[node name="Casing" type="RigidDynamicBody3D"]
|
||||
transform = Transform3D(0.998201, 0, 0, 0, 0.998201, 0, 0, 0, 0.998201, 0, 0, 0)
|
||||
collision_layer = 8
|
||||
collision_mask = 15
|
||||
continuous_cd = true
|
||||
contacts_reported = 1
|
||||
contact_monitor = true
|
||||
script = ExtResource( "1_kwgjj" )
|
||||
|
||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||
|
@ -19,6 +154,9 @@ script = null
|
|||
[node name="Casing" parent="." instance=ExtResource( "1" )]
|
||||
transform = Transform3D(-4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0)
|
||||
|
||||
[node name="Casing_LOD0" parent="Casing" index="0"]
|
||||
gi_mode = 2
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 5.0
|
||||
one_shot = true
|
||||
|
@ -37,4 +175,15 @@ unit_size = 2.0
|
|||
max_db = -3.0
|
||||
pitch_scale = 1.5
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
root_node = NodePath("../Casing")
|
||||
anims/Fade = SubResource( "Animation_euct2" )
|
||||
anims/RESET = SubResource( "Animation_u4pct" )
|
||||
blend_times = []
|
||||
script = null
|
||||
|
||||
[connection signal="body_entered" from="." to="." method="_on_Casing_body_entered"]
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_Timer_timeout"]
|
||||
|
||||
[editable path="Casing"]
|
||||
[editable path="Sound"]
|
||||
|
|
Reference in New Issue