forked from unfa/liblast
Implemented bullet tracers
This commit is contained in:
parent
aef7f93f27
commit
7edcf2fd1c
5 changed files with 257 additions and 25 deletions
19
Game/Assets/Effects/BulletTracer.gd
Normal file
19
Game/Assets/Effects/BulletTracer.gd
Normal file
|
@ -0,0 +1,19 @@
|
|||
extends Node3D
|
||||
|
||||
const SPEED = 200
|
||||
|
||||
# Declare member variables here. Examples:
|
||||
# var a = 2
|
||||
# var b = "text"
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
translate_object_local(Vector3.UP * SPEED / 60 * randf_range(0, 1)) # randomize starting point
|
||||
$RayCast3D.target_position = Vector3.UP * SPEED / 60
|
||||
|
||||
func _process(delta):
|
||||
if $RayCast3D.is_colliding():
|
||||
queue_free()
|
||||
else:
|
||||
translate_object_local(Vector3.UP * SPEED * delta)
|
126
Game/Assets/Effects/BulletTracer.gltf
Normal file
126
Game/Assets/Effects/BulletTracer.gltf
Normal file
|
@ -0,0 +1,126 @@
|
|||
{
|
||||
"asset" : {
|
||||
"generator" : "Khronos glTF Blender I/O v1.7.23",
|
||||
"version" : "2.0"
|
||||
},
|
||||
"scene" : 0,
|
||||
"scenes" : [
|
||||
{
|
||||
"name" : "Scene",
|
||||
"nodes" : [
|
||||
0
|
||||
]
|
||||
}
|
||||
],
|
||||
"nodes" : [
|
||||
{
|
||||
"mesh" : 0,
|
||||
"name" : "Tracer"
|
||||
}
|
||||
],
|
||||
"materials" : [
|
||||
{
|
||||
"doubleSided" : true,
|
||||
"emissiveFactor" : [
|
||||
1,
|
||||
1,
|
||||
1
|
||||
],
|
||||
"name" : "BulletTracerMaterial",
|
||||
"pbrMetallicRoughness" : {}
|
||||
}
|
||||
],
|
||||
"meshes" : [
|
||||
{
|
||||
"name" : "Sphere",
|
||||
"primitives" : [
|
||||
{
|
||||
"attributes" : {
|
||||
"POSITION" : 0,
|
||||
"NORMAL" : 1,
|
||||
"TEXCOORD_0" : 2,
|
||||
"COLOR_0" : 3
|
||||
},
|
||||
"indices" : 4,
|
||||
"material" : 0
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"accessors" : [
|
||||
{
|
||||
"bufferView" : 0,
|
||||
"componentType" : 5126,
|
||||
"count" : 15,
|
||||
"max" : [
|
||||
0.08660250902175903,
|
||||
0.07499998807907104,
|
||||
0.10000002384185791
|
||||
],
|
||||
"min" : [
|
||||
-0.08660256862640381,
|
||||
-0.07499998807907104,
|
||||
-12.261317253112793
|
||||
],
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 1,
|
||||
"componentType" : 5126,
|
||||
"count" : 15,
|
||||
"type" : "VEC3"
|
||||
},
|
||||
{
|
||||
"bufferView" : 2,
|
||||
"componentType" : 5126,
|
||||
"count" : 15,
|
||||
"type" : "VEC2"
|
||||
},
|
||||
{
|
||||
"bufferView" : 3,
|
||||
"componentType" : 5123,
|
||||
"count" : 15,
|
||||
"normalized" : true,
|
||||
"type" : "VEC4"
|
||||
},
|
||||
{
|
||||
"bufferView" : 4,
|
||||
"componentType" : 5123,
|
||||
"count" : 90,
|
||||
"type" : "SCALAR"
|
||||
}
|
||||
],
|
||||
"bufferViews" : [
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 180,
|
||||
"byteOffset" : 0
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 180,
|
||||
"byteOffset" : 180
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 120,
|
||||
"byteOffset" : 360
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 120,
|
||||
"byteOffset" : 480
|
||||
},
|
||||
{
|
||||
"buffer" : 0,
|
||||
"byteLength" : 180,
|
||||
"byteOffset" : 600
|
||||
}
|
||||
],
|
||||
"buffers" : [
|
||||
{
|
||||
"byteLength" : 780,
|
||||
"uri" : "data:application/octet-stream;base64,qFyxPcjMzDGQp/m9oFEMPRAKc73AJzA8sFwxPZiZmb2Qp/m9mFEMvRAKc73IJzA8sFwxvZiZmb2Qp/m9mFGMvVCwELLQJzA8sFyxvcjMzLGQp/m90MxMstDMTKVbLkTBAAAAANDMTKXQzMw9mFEMvRAKcz3YJzA8sFwxvZiZmT2Qp/m9oFEMPRAKcz3IJzA8sFwxPZiZmT2Qp/m9mFGMPYBbmbLAJzA8AAAAAAAAAACeYsjAANJ/PwAAAAAuwRY93vnuPp71Tr9vjbc+ANL/PruLXb8uwRY93vnuvp71Tr9vjbc+ANL/vruLXb8uwRY93vluvwAAAABvjbc+ANJ/vwAAAAAuwRY9AAAAAAAAAAAAAIC/AAAAAAAAAAAAAIA/3vnuvp71Tj9vjbc+ANL/vruLXT8uwRY93vnuPp71Tj9vjbc+ANL/PruLXT8uwRY93vluPwAAAABvjbc+AAAAAAAAAAAAAIC/AACAP4pnez8IojI/0iZ+Pw8BQD+KZ3s/8buaPtImfj9OAIA+imd7P/Hh1T3SJn4/AAAAAIpnez/pAAA/AAAAAOkAAD8AAIA/8buaPtImfj9OAIA+imd7PwiiMj/SJn4/DwFAP4pnez/4RGU/0iZ+P+kAAD++fPg+E04TThNO/////////////xNOE04TTv////////////8TThNOE07/////////////E04TThNO//8AAAAAAAD///////////////////////8TThNOE07/////////////E04TThNO/////////////wAAAAAAAP//BwAAAAIAAAANAAEAAAABAAIADQAIAAEABwACAAQAAgABAAMAAgADAAQAAQAIAAMABwAEAAYABAADAAUABAAFAAYAAwAIAAUABwAGAAoABgAFAAkABgAJAAoABQAIAAkABwAKAAwACgAJAAsACgALAAwACQAIAAsABwAMAAAADAALAA0ADAANAAAACwAIAA0ABgAKAA4ADAAAAA4ABAAGAA4ACgAMAA4AAgAEAA4AAAACAA4A"
|
||||
}
|
||||
]
|
||||
}
|
30
Game/Assets/Effects/BulletTracer.gltf.import
Normal file
30
Game/Assets/Effects/BulletTracer.gltf.import
Normal file
|
@ -0,0 +1,30 @@
|
|||
[remap]
|
||||
|
||||
importer="scene"
|
||||
importer_version=1
|
||||
type="PackedScene"
|
||||
uid="uid://0lglx6ofswni"
|
||||
path="res://.godot/imported/BulletTracer.gltf-df573e756fdb2178a91083c47d6b0f0d.scn"
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://Assets/Effects/BulletTracer.gltf"
|
||||
dest_files=["res://.godot/imported/BulletTracer.gltf-df573e756fdb2178a91083c47d6b0f0d.scn"]
|
||||
|
||||
[params]
|
||||
|
||||
nodes/root_type="Node3D"
|
||||
nodes/root_name="Scene Root"
|
||||
nodes/root_scale=1.0
|
||||
meshes/ensure_tangents=true
|
||||
meshes/generate_lods=true
|
||||
meshes/create_shadow_meshes=true
|
||||
meshes/light_baking=2
|
||||
meshes/lightmap_texel_size=0.1
|
||||
skins/use_named_skins=true
|
||||
animation/import=true
|
||||
animation/bake_reset_animation=true
|
||||
animation/fps=15
|
||||
import_script/path=""
|
||||
_subresources={
|
||||
}
|
62
Game/Assets/Effects/BulletTracer.tscn
Normal file
62
Game/Assets/Effects/BulletTracer.tscn
Normal file
|
@ -0,0 +1,62 @@
|
|||
[gd_scene load_steps=5 format=3 uid="uid://eerqpr05s6d4"]
|
||||
|
||||
[ext_resource type="Script" path="res://Assets/Effects/BulletTracer.gd" id="1_prhxw"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_lgb7o"]
|
||||
resource_name = "BulletTracerMaterial"
|
||||
cull_mode = 2
|
||||
vertex_color_use_as_albedo = true
|
||||
albedo_color = Color(1, 0.627451, 0, 1)
|
||||
metallic = 1.0
|
||||
emission_enabled = true
|
||||
emission = Color(1, 1, 1, 1)
|
||||
disable_receive_shadows = true
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_ee1b4"]
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-0.0866026, -0.075, -12.2613, 0.173215, 0.15, 12.3613),
|
||||
"format": 4097,
|
||||
"index_count": 90,
|
||||
"index_data": PackedByteArray(7, 0, 2, 0, 0, 0, 0, 0, 1, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0, 7, 0, 4, 0, 2, 0, 2, 0, 3, 0, 1, 0, 2, 0, 4, 0, 3, 0, 1, 0, 3, 0, 8, 0, 7, 0, 6, 0, 4, 0, 4, 0, 5, 0, 3, 0, 4, 0, 6, 0, 5, 0, 3, 0, 5, 0, 8, 0, 7, 0, 10, 0, 6, 0, 6, 0, 9, 0, 5, 0, 6, 0, 10, 0, 9, 0, 5, 0, 9, 0, 8, 0, 7, 0, 12, 0, 10, 0, 10, 0, 11, 0, 9, 0, 10, 0, 12, 0, 11, 0, 9, 0, 11, 0, 8, 0, 7, 0, 0, 0, 12, 0, 12, 0, 13, 0, 11, 0, 12, 0, 0, 0, 13, 0, 11, 0, 13, 0, 8, 0, 6, 0, 14, 0, 10, 0, 12, 0, 14, 0, 0, 0, 4, 0, 14, 0, 6, 0, 10, 0, 14, 0, 12, 0, 2, 0, 14, 0, 4, 0, 0, 0, 14, 0, 2, 0),
|
||||
"lods": [5.30833, PackedByteArray(7, 0, 2, 0, 0, 0, 0, 0, 1, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0, 7, 0, 4, 0, 2, 0, 2, 0, 3, 0, 1, 0, 2, 0, 4, 0, 3, 0, 1, 0, 3, 0, 8, 0, 7, 0, 6, 0, 4, 0, 4, 0, 5, 0, 3, 0, 4, 0, 6, 0, 5, 0, 3, 0, 5, 0, 8, 0, 7, 0, 10, 0, 6, 0, 6, 0, 9, 0, 5, 0, 6, 0, 10, 0, 9, 0, 5, 0, 9, 0, 8, 0, 7, 0, 12, 0, 10, 0, 10, 0, 11, 0, 9, 0, 10, 0, 12, 0, 11, 0, 9, 0, 11, 0, 8, 0), 7.97207, PackedByteArray(7, 0, 3, 0, 0, 0, 0, 0, 1, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0, 7, 0, 4, 0, 2, 0, 2, 0, 3, 0, 1, 0, 2, 0, 4, 0, 3, 0, 1, 0, 3, 0, 8, 0, 7, 0, 6, 0, 4, 0, 4, 0, 5, 0, 3, 0, 4, 0, 6, 0, 5, 0, 3, 0, 5, 0, 8, 0), 10.8683, PackedByteArray(7, 0, 3, 0, 13, 0, 0, 0, 1, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0, 7, 0, 4, 0, 2, 0, 2, 0, 3, 0, 1, 0, 2, 0, 4, 0, 3, 0, 1, 0, 3, 0, 8, 0, 7, 0, 6, 0, 4, 0, 4, 0, 5, 0, 3, 0), 12.0821, PackedByteArray(7, 0, 3, 0, 13, 0, 11, 0, 1, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0, 7, 0, 4, 0, 2, 0, 2, 0, 3, 0, 1, 0, 2, 0, 4, 0, 3, 0), 12.0942, PackedByteArray(7, 0, 3, 0, 13, 0, 11, 0, 11, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0)],
|
||||
"name": "BulletTracerMaterial",
|
||||
"primitive": 3,
|
||||
"vertex_count": 15,
|
||||
"vertex_data": PackedByteArray(168, 92, 177, 61, 200, 204, 204, 49, 144, 167, 249, 189, 160, 81, 12, 61, 16, 10, 115, 189, 192, 39, 48, 60, 176, 92, 49, 61, 152, 153, 153, 189, 144, 167, 249, 189, 152, 81, 12, 189, 16, 10, 115, 189, 200, 39, 48, 60, 176, 92, 49, 189, 152, 153, 153, 189, 144, 167, 249, 189, 152, 81, 140, 189, 80, 176, 16, 178, 208, 39, 48, 60, 176, 92, 177, 189, 200, 204, 204, 177, 144, 167, 249, 189, 208, 204, 76, 178, 208, 204, 76, 165, 91, 46, 68, 193, 0, 0, 0, 0, 208, 204, 76, 165, 208, 204, 204, 61, 152, 81, 12, 189, 16, 10, 115, 61, 216, 39, 48, 60, 176, 92, 49, 189, 152, 153, 153, 61, 144, 167, 249, 189, 160, 81, 12, 61, 16, 10, 115, 61, 200, 39, 48, 60, 176, 92, 49, 61, 152, 153, 153, 61, 144, 167, 249, 189, 152, 81, 140, 61, 128, 91, 153, 178, 192, 39, 48, 60, 0, 0, 0, 0, 0, 0, 0, 0, 158, 98, 200, 192)
|
||||
}]
|
||||
blend_shape_mode = 0
|
||||
|
||||
[sub_resource type="ArrayMesh" id="ArrayMesh_lv12o"]
|
||||
resource_name = "BulletTracer_Sphere"
|
||||
_surfaces = [{
|
||||
"aabb": AABB(-0.0866026, -0.075, -12.2613, 0.173215, 0.15, 12.3613),
|
||||
"attribute_data": PackedByteArray(77, 77, 77, 255, 0, 0, 128, 63, 138, 103, 123, 63, 255, 255, 255, 255, 8, 162, 50, 63, 210, 38, 126, 63, 77, 77, 77, 255, 15, 1, 64, 63, 138, 103, 123, 63, 255, 255, 255, 255, 241, 187, 154, 62, 210, 38, 126, 63, 77, 77, 77, 255, 78, 0, 128, 62, 138, 103, 123, 63, 255, 255, 255, 255, 241, 225, 213, 61, 210, 38, 126, 63, 77, 77, 77, 255, 0, 0, 0, 0, 138, 103, 123, 63, 0, 0, 0, 255, 233, 0, 0, 63, 0, 0, 0, 0, 255, 255, 255, 255, 233, 0, 0, 63, 0, 0, 128, 63, 255, 255, 255, 255, 241, 187, 154, 62, 210, 38, 126, 63, 77, 77, 77, 255, 78, 0, 128, 62, 138, 103, 123, 63, 255, 255, 255, 255, 8, 162, 50, 63, 210, 38, 126, 63, 77, 77, 77, 255, 15, 1, 64, 63, 138, 103, 123, 63, 255, 255, 255, 255, 248, 68, 101, 63, 210, 38, 126, 63, 0, 0, 0, 255, 233, 0, 0, 63, 190, 124, 248, 62),
|
||||
"format": 4127,
|
||||
"index_count": 90,
|
||||
"index_data": PackedByteArray(7, 0, 2, 0, 0, 0, 0, 0, 1, 0, 13, 0, 0, 0, 2, 0, 1, 0, 13, 0, 1, 0, 8, 0, 7, 0, 4, 0, 2, 0, 2, 0, 3, 0, 1, 0, 2, 0, 4, 0, 3, 0, 1, 0, 3, 0, 8, 0, 7, 0, 6, 0, 4, 0, 4, 0, 5, 0, 3, 0, 4, 0, 6, 0, 5, 0, 3, 0, 5, 0, 8, 0, 7, 0, 10, 0, 6, 0, 6, 0, 9, 0, 5, 0, 6, 0, 10, 0, 9, 0, 5, 0, 9, 0, 8, 0, 7, 0, 12, 0, 10, 0, 10, 0, 11, 0, 9, 0, 10, 0, 12, 0, 11, 0, 9, 0, 11, 0, 8, 0, 7, 0, 0, 0, 12, 0, 12, 0, 13, 0, 11, 0, 12, 0, 0, 0, 13, 0, 11, 0, 13, 0, 8, 0, 6, 0, 14, 0, 10, 0, 12, 0, 14, 0, 0, 0, 4, 0, 14, 0, 6, 0, 10, 0, 14, 0, 12, 0, 2, 0, 14, 0, 4, 0, 0, 0, 14, 0, 2, 0),
|
||||
"lods": [5.30833, PackedByteArray(7, 0, 1, 0, 13, 0, 13, 0, 1, 0, 8, 0, 7, 0, 3, 0, 1, 0, 1, 0, 3, 0, 8, 0, 7, 0, 5, 0, 3, 0, 3, 0, 5, 0, 8, 0, 7, 0, 9, 0, 5, 0, 5, 0, 9, 0, 8, 0, 7, 0, 12, 0, 9, 0, 9, 0, 12, 0, 11, 0, 9, 0, 11, 0, 8, 0, 7, 0, 13, 0, 12, 0, 12, 0, 13, 0, 11, 0, 11, 0, 13, 0, 8, 0, 5, 0, 14, 0, 9, 0, 12, 0, 14, 0, 13, 0, 3, 0, 14, 0, 5, 0, 9, 0, 14, 0, 12, 0, 1, 0, 14, 0, 3, 0, 13, 0, 14, 0, 1, 0), 7.97207, PackedByteArray(7, 0, 3, 0, 13, 0, 13, 0, 3, 0, 8, 0, 7, 0, 5, 0, 3, 0, 3, 0, 5, 0, 8, 0, 7, 0, 11, 0, 5, 0, 5, 0, 11, 0, 8, 0, 7, 0, 13, 0, 11, 0, 11, 0, 13, 0, 8, 0, 11, 0, 14, 0, 13, 0, 3, 0, 14, 0, 5, 0, 5, 0, 14, 0, 11, 0, 13, 0, 14, 0, 3, 0), 10.8683, PackedByteArray(7, 0, 3, 0, 13, 0, 13, 0, 3, 0, 5, 0, 7, 0, 5, 0, 3, 0, 7, 0, 11, 0, 5, 0, 7, 0, 13, 0, 11, 0, 11, 0, 13, 0, 5, 0, 11, 0, 14, 0, 13, 0, 3, 0, 14, 0, 5, 0, 5, 0, 14, 0, 11, 0, 13, 0, 14, 0, 3, 0), 12.0821, PackedByteArray(7, 0, 3, 0, 11, 0, 11, 0, 3, 0, 5, 0, 7, 0, 5, 0, 3, 0, 7, 0, 11, 0, 5, 0, 3, 0, 14, 0, 5, 0, 5, 0, 14, 0, 11, 0, 11, 0, 14, 0, 3, 0), 12.0942, PackedByteArray(7, 0, 3, 0, 11, 0, 7, 0, 11, 0, 3, 0, 3, 0, 14, 0, 11, 0, 11, 0, 14, 0, 3, 0)],
|
||||
"material": SubResource( "StandardMaterial3D_lgb7o" ),
|
||||
"name": "BulletTracerMaterial",
|
||||
"primitive": 3,
|
||||
"vertex_count": 15,
|
||||
"vertex_data": PackedByteArray(168, 92, 177, 61, 200, 204, 204, 49, 144, 167, 249, 189, 254, 255, 39, 33, 255, 249, 79, 31, 160, 81, 12, 61, 16, 10, 115, 189, 192, 39, 48, 60, 238, 134, 97, 43, 186, 255, 251, 31, 176, 92, 49, 61, 152, 153, 153, 189, 144, 167, 249, 189, 255, 18, 33, 33, 186, 255, 251, 31, 152, 81, 12, 189, 16, 10, 115, 189, 200, 39, 48, 60, 16, 133, 97, 43, 186, 255, 243, 31, 176, 92, 49, 189, 152, 153, 153, 189, 144, 167, 249, 189, 255, 16, 33, 33, 186, 255, 243, 31, 152, 81, 140, 189, 80, 176, 16, 178, 208, 39, 48, 60, 34, 252, 103, 43, 36, 210, 15, 230, 176, 92, 177, 189, 200, 204, 204, 177, 144, 167, 249, 189, 0, 252, 39, 33, 255, 1, 160, 32, 208, 204, 76, 178, 208, 204, 76, 165, 91, 46, 68, 193, 255, 253, 7, 0, 255, 255, 247, 223, 0, 0, 0, 0, 208, 204, 76, 165, 208, 204, 204, 61, 255, 253, 247, 63, 255, 255, 247, 223, 152, 81, 12, 189, 16, 10, 115, 61, 216, 39, 48, 60, 16, 117, 110, 43, 186, 255, 251, 223, 176, 92, 49, 189, 152, 153, 153, 61, 144, 167, 249, 189, 255, 232, 46, 33, 186, 255, 251, 223, 160, 81, 12, 61, 16, 10, 115, 61, 200, 39, 48, 60, 238, 118, 110, 43, 186, 255, 243, 223, 176, 92, 49, 61, 152, 153, 153, 61, 144, 167, 249, 189, 255, 234, 46, 33, 186, 255, 243, 223, 152, 81, 140, 61, 128, 91, 153, 178, 192, 39, 48, 60, 220, 255, 103, 43, 36, 42, 224, 217, 0, 0, 0, 0, 0, 0, 0, 0, 158, 98, 200, 192, 255, 253, 7, 0, 255, 255, 247, 31)
|
||||
}]
|
||||
blend_shape_mode = 0
|
||||
shadow_mesh = SubResource( "ArrayMesh_ee1b4" )
|
||||
|
||||
[node name="BulletTracer" type="Node3D"]
|
||||
script = ExtResource( "1_prhxw" )
|
||||
|
||||
[node name="RayCast3D" type="RayCast3D" parent="."]
|
||||
transform = Transform3D(-5.73206e-15, 1, 4.37114e-08, -1.31134e-07, -4.37114e-08, 1, 1, 0, 1.31134e-07, 0, 0, 0)
|
||||
target_position = Vector3(0, 0, 5)
|
||||
collision_mask = 3
|
||||
script = null
|
||||
|
||||
[node name="Tracer" type="MeshInstance3D" parent="."]
|
||||
transform = Transform3D(7.54979e-09, 0.1, 2.18557e-08, 0, -4.37114e-09, 0.5, 0.1, -7.54979e-09, -1.65006e-15, 0, 6.25509, 0)
|
||||
gi_mode = 1
|
||||
mesh = SubResource( "ArrayMesh_lv12o" )
|
||||
skeleton = NodePath("")
|
||||
surface_material_override/0 = null
|
||||
script = null
|
|
@ -10,6 +10,7 @@ extends Node3D
|
|||
|
||||
var casing = preload("res://Assets/Weapons/Handgun/Casing.tscn")
|
||||
var flash = preload("res://Assets/Effects/MuzzleFlash.tscn")
|
||||
var tracer = preload("res://Assets/Effects/BulletTracer.tscn")
|
||||
var impact_wall = preload("res://Assets/Effects/ImpactSparks.tscn")
|
||||
var impact_player = preload("res://Assets/Effects/ImpactBlood.tscn")
|
||||
|
||||
|
@ -33,6 +34,24 @@ var impact_player = preload("res://Assets/Effects/ImpactBlood.tscn")
|
|||
$"Handgun/SFX/Shoot B".play()
|
||||
$"Handgun/SFX/Shoot C".play()
|
||||
|
||||
$Handgun/AnimationPlayer.play("Shoot", 0, 2.5)
|
||||
|
||||
var flash_effect = flash.instantiate()
|
||||
var tracer_effect = tracer.instantiate()
|
||||
|
||||
get_parent().add_child(flash_effect)
|
||||
get_tree().root.add_child(tracer_effect)
|
||||
flash_effect.global_transform = muzzle.global_transform
|
||||
tracer_effect.global_transform = muzzle.global_transform
|
||||
|
||||
var casing_instance = casing.instantiate()
|
||||
get_tree().root.add_child(casing_instance)
|
||||
|
||||
casing_instance.global_transform = ejector.global_transform.translated(player.linear_velocity / 60) #approximating delta
|
||||
casing_instance.linear_velocity = ejector.global_transform.basis[1] * randf_range(3.2, 4.5) + (player.linear_velocity / 2)
|
||||
casing_instance.angular_velocity.y += randf_range(-10, 10)
|
||||
casing_instance.angular_velocity.x += randf_range(-10, 10)
|
||||
|
||||
var impact_vfx
|
||||
|
||||
if ray: # did we hit anything?
|
||||
|
@ -85,31 +104,7 @@ func trigger(index: int, active: bool) -> void:
|
|||
if index == 0 and active and $Handgun/AnimationPlayer.is_playing() == false:
|
||||
|
||||
rpc(&'shoot')
|
||||
|
||||
$Handgun/AnimationPlayer.play("Shoot", 0, 2.5)
|
||||
|
||||
var flash_effect
|
||||
if flash.has_method(&"instance"):
|
||||
flash_effect = flash.instance()
|
||||
else:
|
||||
flash_effect = flash.instantiate()
|
||||
|
||||
get_parent().add_child(flash_effect)
|
||||
flash_effect.global_transform = muzzle.global_transform
|
||||
|
||||
var casing_instance
|
||||
if casing.has_method(&"instance"):
|
||||
casing_instance = casing.instance()
|
||||
else:
|
||||
casing_instance = casing.instantiate()
|
||||
|
||||
get_tree().root.add_child(casing_instance)
|
||||
|
||||
casing_instance.global_transform = ejector.global_transform.translated(player.linear_velocity / 60) #approximating delta
|
||||
casing_instance.linear_velocity = ejector.global_transform.basis[1] * randf_range(3.2, 4.5) + (player.linear_velocity / 2)
|
||||
casing_instance.angular_velocity.y += randf_range(-10, 10)
|
||||
casing_instance.angular_velocity.x += randf_range(-10, 10)
|
||||
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready():
|
||||
# align the sound source with the head to produce balanced stereo
|
||||
|
|
Loading…
Reference in a new issue