feat: added muzzle flash effect

This commit is contained in:
Sara Gerretsen 2026-06-28 17:05:33 +02:00
parent d323fbf4d9
commit e55710ffa9
9 changed files with 238 additions and 11 deletions

View file

@ -0,0 +1,12 @@
[gd_resource type="StandardMaterial3D" format=3 uid="uid://m455klqx66wi"]
[ext_resource type="Texture2D" uid="uid://dxaayr4rwry4p" path="res://assets/effects/particle_textures/muzzle_flash_round_albedo.png" id="1_l0001"]
[resource]
transparency = 4
blend_mode = 1
cull_mode = 2
shading_mode = 0
specular_mode = 2
albedo_texture = ExtResource("1_l0001")
texture_repeat = false

View file

@ -0,0 +1,84 @@
[remap]
importer="scene"
importer_version=1
type="PackedScene"
uid="uid://djrrcxl6xj2bn"
path="res://.godot/imported/muzzle_flash.blend-20b3348fcd309fb1e44d398240af9b2a.scn"
[deps]
source_file="res://assets/effects/particle_meshes/muzzle_flash.blend"
dest_files=["res://.godot/imported/muzzle_flash.blend-20b3348fcd309fb1e44d398240af9b2a.scn"]
[params]
nodes/root_type=""
nodes/root_name=""
nodes/root_script=null
nodes/apply_root_scale=true
nodes/root_scale=1.0
nodes/import_as_skeleton_bones=false
nodes/use_name_suffixes=true
nodes/use_node_type_suffixes=true
meshes/ensure_tangents=true
meshes/generate_lods=true
meshes/create_shadow_meshes=true
meshes/light_baking=1
meshes/lightmap_texel_size=0.2
meshes/force_disable_compression=false
skins/use_named_skins=true
animation/import=true
animation/fps=30
animation/trimming=false
animation/remove_immutable_tracks=true
animation/import_rest_as_RESET=false
import_script/path=""
materials/extract=0
materials/extract_format=0
materials/extract_path=""
_subresources={
"materials": {
"Material": {
"use_external/enabled": true,
"use_external/fallback_path": "res://assets/effects/particle_materials/muzzle_flash.tres",
"use_external/path": "uid://m455klqx66wi"
}
},
"meshes": {
"muzzle_flash_Plane": {
"generate/lightmap_uv": 2,
"generate/lods": 2,
"generate/shadow_meshes": 2,
"lods/normal_merge_angle": 20.0,
"save_to_file/enabled": false,
"save_to_file/fallback_path": "",
"save_to_file/path": ""
}
},
"nodes": {
"PATH:Plane": {
"mesh_instance/cast_shadow": 0
}
}
}
blender/nodes/visible=0
blender/nodes/active_collection_only=false
blender/nodes/punctual_lights=true
blender/nodes/cameras=true
blender/nodes/custom_properties=true
blender/nodes/modifiers=1
blender/meshes/colors=false
blender/meshes/uvs=true
blender/meshes/normals=true
blender/meshes/export_geometry_nodes_instances=false
blender/meshes/gpu_instances=false
blender/meshes/tangents=true
blender/meshes/skins=2
blender/meshes/export_bones_deforming_mesh_only=false
blender/materials/unpack_enabled=true
blender/materials/export_materials=1
blender/animation/limit_playback=true
blender/animation/always_sample=true
blender/animation/group_tracks=true
gltf/naming_version=2

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

View file

@ -0,0 +1,41 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://dxaayr4rwry4p"
path.s3tc="res://.godot/imported/muzzle_flash_round_albedo.png-ee548c72f079381bc8ca542c61de0471.s3tc.ctex"
metadata={
"imported_formats": ["s3tc_bptc"],
"vram_texture": true
}
[deps]
source_file="res://assets/effects/particle_textures/muzzle_flash_round_albedo.png"
dest_files=["res://.godot/imported/muzzle_flash_round_albedo.png-ee548c72f079381bc8ca542c61de0471.s3tc.ctex"]
[params]
compress/mode=2
compress/high_quality=false
compress/lossy_quality=0.7
compress/uastc_level=0
compress/rdo_quality_loss=0.0
compress/hdr_compression=1
compress/normal_map=0
compress/channel_pack=0
mipmaps/generate=true
mipmaps/limit=-1
roughness/mode=0
roughness/src_normal=""
process/channel_remap/red=0
process/channel_remap/green=1
process/channel_remap/blue=2
process/channel_remap/alpha=3
process/fix_alpha_border=true
process/premult_alpha=false
process/normal_map_invert_y=false
process/hdr_as_srgb=false
process/hdr_clamp_exposure=false
process/size_limit=0
detect_3d/compress_to=0

View file

@ -0,0 +1,22 @@
[gd_scene format=3 uid="uid://l75s41qssbtt"]
[ext_resource type="PackedScene" uid="uid://djrrcxl6xj2bn" path="res://assets/effects/particle_meshes/muzzle_flash.blend" id="1_obte5"]
[node name="MuzzleFlash" type="Node3D" unique_id=1926532223]
[node name="muzzle_flash" parent="." unique_id=1320230612 instance=ExtResource("1_obte5")]
transform = Transform3D(0.6942942, -0.7196913, 0, 0.7196913, 0.6942942, 0, 0, 0, 1, 5.3033233e-05, -6.99535e-05, -0.009353278)
[node name="OmniLight3D" type="OmniLight3D" parent="." unique_id=441714159]
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.068469256)
light_intensity_lumens = 100000.0
light_temperature = 2594.0
light_energy = 16.0
omni_range = 2.0
[node name="Timer" type="Timer" parent="." unique_id=1595500559]
wait_time = 0.05
one_shot = true
autostart = true
[connection signal="timeout" from="Timer" to="." method="queue_free"]

View file

@ -1,12 +1,20 @@
[gd_scene format=3 uid="uid://cfgwif53qypko"]
[ext_resource type="PackedScene" uid="uid://dmkju5w7mfp65" path="res://assets/models/weapons/revolver.blend" id="1_5ynga"]
[ext_resource type="PackedScene" uid="uid://l75s41qssbtt" path="res://objects/effects/muzzle_flash.tscn" id="2_xtgk6"]
[sub_resource type="GDScript" id="GDScript_5ynga"]
script/source = "extends MuzzleEffect
@export var particles : PackedScene
func trigger() -> void:
SoundEventPatchboard.trigger_sound(global_position, 100)
if particles and particles.can_instantiate():
var instance : Node3D = particles.instantiate()
instance.transform = global_transform
get_tree().current_scene.add_child(instance)
"
[node name="Revolver" type="Revolver" unique_id=1509965416 node_paths=PackedStringArray("anim")]
@ -18,20 +26,71 @@ double_action_spread = 0.04
[node name="revolver" parent="." unique_id=920739050 instance=ExtResource("1_5ynga")]
[node name="Body" parent="revolver/Character/Skeleton3D" parent_id_path=PackedInt32Array(920739050, 1237005388) index="0" unique_id=757337077]
[node name="Skeleton3D" parent="revolver/Character" parent_id_path=PackedInt32Array(920739050, 580257283) index="0" unique_id=1237005388]
bones/1/position = Vector3(0.077683, 0.15356629, 0.22951864)
bones/1/rotation = Quaternion(0.5851843, 0.4764963, 0.47324383, -0.45447868)
bones/2/rotation = Quaternion(-0.130586, 0.0369961, 0.61635566, 0.7756831)
bones/3/rotation = Quaternion(0.04178224, 0.11465855, 0.2751497, 0.9536249)
bones/4/rotation = Quaternion(0.1438401, 0.35638994, -0.2608724, 0.8855743)
bones/5/rotation = Quaternion(-0.22070737, 0.14418079, 0.13519567, 0.95510334)
bones/6/rotation = Quaternion(-0.100188054, 0.0017374307, -0.01725145, 0.99481744)
bones/7/rotation = Quaternion(-0.5670921, 0.00026772878, -0.00039003103, 0.82365435)
bones/8/position = Vector3(-0.00024729938, 0.09413031, 0.006029021)
bones/8/rotation = Quaternion(-0.67974395, 0.15276042, 0.07346369, 0.7135934)
bones/9/rotation = Quaternion(-0.5241326, -0.0052551194, 0.008540807, 0.8515776)
bones/10/rotation = Quaternion(-0.45302963, 0.0016381196, -0.0032266802, 0.89148813)
bones/11/position = Vector3(0.019964732, 0.089208744, -0.0011444051)
bones/11/rotation = Quaternion(-0.6447599, 0.17695157, 0.030249286, 0.74300593)
bones/12/rotation = Quaternion(-0.61815894, -0.005842373, 0.008146181, 0.78598917)
bones/13/rotation = Quaternion(-0.28957173, 0.00089087046, -0.0035062514, 0.95714945)
bones/14/rotation = Quaternion(-0.4137267, 0.18337817, -0.055713173, 0.88999933)
bones/15/rotation = Quaternion(-0.56248397, 0.00851621, 0.018579122, 0.82655555)
bones/16/rotation = Quaternion(-0.51711315, -0.0032988975, -0.013025862, 0.85581154)
bones/17/position = Vector3(-0.035217397, 0.031610142, 0.01092668)
bones/17/rotation = Quaternion(-0.4766158, 0.022983566, 0.16551939, 0.8630831)
bones/18/rotation = Quaternion(0.3054513, -0.076055326, -0.15467337, 0.9364782)
bones/19/rotation = Quaternion(0.0080123, 0.013962941, -0.36334667, 0.9315149)
bones/20/position = Vector3(-0.077683, 0.12932053, 0.0004705212)
bones/20/rotation = Quaternion(0.5851843, -0.4764963, -0.47324383, -0.45447868)
bones/21/rotation = Quaternion(-0.054112177, 0.041348223, 0.06595896, 0.9954957)
bones/22/rotation = Quaternion(-0.026361315, 0.047682222, -0.08761911, 0.99466294)
bones/23/rotation = Quaternion(0.0087715145, 0.00401132, -0.041260336, 0.9991019)
bones/25/rotation = Quaternion(-0.00016073987, -2.7729832e-06, 0.017338712, 0.9998497)
bones/26/rotation = Quaternion(-5.533049e-06, 8.158348e-07, 0.000472692, 0.9999999)
bones/27/rotation = Quaternion(-0.09291299, -0.16547912, 0.03673224, 0.9811394)
bones/28/rotation = Quaternion(9.743209e-05, -2.249952e-06, -0.010027913, 0.9999498)
bones/29/rotation = Quaternion(-3.571963e-05, 1.3003668e-06, 0.0036188553, 0.99999344)
bones/30/rotation = Quaternion(-0.09937216, -0.162095, 0.07714952, 0.9787228)
bones/31/rotation = Quaternion(0.0005252566, -0.0004487199, -0.010014582, 0.99994963)
bones/32/rotation = Quaternion(-0.00018943015, 0.00016181999, 0.0036140762, 0.99999344)
bones/33/rotation = Quaternion(-0.10820272, -0.15602519, 0.111299604, 0.9754798)
bones/35/rotation = Quaternion(-0.008701338, 0.009477453, 0.009525659, 0.9998719)
bones/36/rotation = Quaternion(-0.08824564, -0.15454084, -0.14938323, 0.97263277)
bones/38/rotation = Quaternion(0.012276233, -0.010414393, 0.02558109, 0.99954313)
bones/39/position = Vector3(0.075784564, -0.25414097, -0.44517958)
bones/39/rotation = Quaternion(-0.14452313, 2.800081e-17, 2.8000815e-17, 0.9895015)
bones/40/position = Vector3(0.018712092, 0.02616787, 0.005937299)
bones/41/rotation = Quaternion(0.13431591, 1.18129094e-07, 1.6011704e-08, 0.99093854)
bones/43/rotation = Quaternion(0.0037203024, 1.1920845e-07, 4.4349532e-10, 0.9999931)
bones/44/rotation = Quaternion(0.9970487, -9.152006e-09, 1.1885747e-07, -0.07677229)
bones/45/position = Vector3(0.012085369, 0.16355935, -0.1564293)
bones/45/rotation = Quaternion(0.8511746, -0.50459415, -0.07369914, -0.124319114)
[node name="Body" parent="revolver/Character/Skeleton3D" index="0" unique_id=757337077]
layers = 2
[node name="Cube" parent="revolver/Character/Skeleton3D" parent_id_path=PackedInt32Array(920739050, 1237005388) index="1" unique_id=1465457237]
[node name="Cube" parent="revolver/Character/Skeleton3D" index="1" unique_id=1465457237]
layers = 2
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="revolver/Character/Skeleton3D" parent_id_path=PackedInt32Array(920739050, 1237005388) index="2" unique_id=1012267645]
transform = Transform3D(1, -6.350722e-17, 4.732016e-17, 4.732016e-17, 0.95822614, 0.28601173, -6.350722e-17, -0.28601173, 0.95822614, 0, -0.03667751, 0.009908612)
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="revolver/Character/Skeleton3D" index="2" unique_id=1012267645]
transform = Transform3D(1, -6.350722e-17, 4.7320154e-17, 4.732016e-17, 0.95822614, 0.28601167, -6.3507215e-17, -0.28601167, 0.95822614, 0.075784564, -0.25414097, -0.44517958)
bone_name = "root"
bone_idx = 39
[node name="MuzzleEffect" type="MuzzleEffect" parent="revolver/Character/Skeleton3D/BoneAttachment3D" unique_id=1214801832]
transform = Transform3D(1, 0, 0, 0, 0.95768696, -0.28781185, 0, 0.28781185, 0.95768696, 2.4018701e-17, 0.19591203, -0.24464998)
transform = Transform3D(1, 0, 0, 0, 0.95768696, -0.28781185, 0, 0.28781185, 0.95768696, 2.4018701e-17, 0.2325248, -0.30887794)
script = SubResource("GDScript_5ynga")
particles = ExtResource("2_xtgk6")
[node name="HitscanMuzzle" type="HitscanMuzzle" parent="." unique_id=1015839339 node_paths=PackedStringArray("muzzle_effect")]
unique_name_in_owner = true

View file

@ -1,12 +1,20 @@
[gd_scene load_steps=3 format=3 uid="uid://ce40pq785yoyi"]
[gd_scene format=3 uid="uid://ce40pq785yoyi"]
[ext_resource type="PackedScene" uid="uid://bodfxp36t6v36" path="res://assets/models/weapons/rifle.blend" id="1_afgyw"]
[ext_resource type="PackedScene" uid="uid://l75s41qssbtt" path="res://objects/effects/muzzle_flash.tscn" id="2_ohdl6"]
[sub_resource type="GDScript" id="GDScript_afgyw"]
script/source = "extends MuzzleEffect
@export var particles : PackedScene
func trigger() -> void:
SoundEventPatchboard.trigger_sound(global_position, 100)
if particles and particles.can_instantiate():
var instance : Node3D = particles.instantiate()
instance.transform = global_transform
get_tree().current_scene.add_child(instance)
"
[node name="Rifle" type="Rifle" unique_id=1273685612 node_paths=PackedStringArray("anim")]
@ -16,22 +24,23 @@ loaded_ammo = 10
[node name="rifle" parent="." unique_id=1135358702 instance=ExtResource("1_afgyw")]
[node name="Body" parent="rifle/Character/Skeleton3D" parent_id_path=PackedInt32Array(1135358702, 975994391) index="0" unique_id=1806569646]
[node name="Body" parent="rifle/Character/Skeleton3D" parent_id_path=PackedInt32Array(1135358702, 2033736171) index="0" unique_id=323697447]
layers = 2
[node name="mesh" parent="rifle/Character/Skeleton3D" parent_id_path=PackedInt32Array(1135358702, 975994391) index="1" unique_id=669938357]
[node name="mesh" parent="rifle/Character/Skeleton3D" parent_id_path=PackedInt32Array(1135358702, 2033736171) index="1" unique_id=1638044681]
layers = 2
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="rifle/Character/Skeleton3D" parent_id_path=PackedInt32Array(1135358702, 975994391) index="2" unique_id=972750814]
[node name="BoneAttachment3D" type="BoneAttachment3D" parent="rifle/Character/Skeleton3D" parent_id_path=PackedInt32Array(1135358702, 2033736171) index="2" unique_id=972750814]
transform = Transform3D(1, -2.0932122e-15, 2.3524223e-18, 2.3525281e-18, 0.0022477505, 0.99999744, -2.0932126e-15, -0.9999974, 0.0022477508, 0.07988295, -0.13953947, -0.33976445)
bone_name = "root"
bone_idx = 39
[node name="MuzzleEffect" type="MuzzleEffect" parent="rifle/Character/Skeleton3D/BoneAttachment3D" unique_id=513449924]
transform = Transform3D(1, 0, 0, 0, 0.95768696, -0.28781185, 0, 0.28781185, 0.95768696, 2.4018701e-17, 0.19591203, -0.24464998)
transform = Transform3D(1.4150418, -6.2038546e-24, -4.2351647e-22, -1.0587912e-21, -6.146729e-08, -0.9829415, 4.9630837e-24, 1.4150468, -4.1909516e-08, 0, 0.736557, 0.15354215)
script = SubResource("GDScript_afgyw")
particles = ExtResource("2_ohdl6")
[node name="AnimationPlayer" parent="rifle" index="2" unique_id=350270435]
[node name="AnimationPlayer" parent="rifle" index="2" unique_id=1822278330]
playback_default_blend_time = 0.1
[node name="HitscanMuzzle" type="HitscanMuzzle" parent="." unique_id=1928749265 node_paths=PackedStringArray("muzzle_effect")]