Fix the sync and add shooting
This commit is contained in:
8
godot/scenes/weapon/misc/bullet_trace_distance.tscn
Normal file
8
godot/scenes/weapon/misc/bullet_trace_distance.tscn
Normal file
@ -0,0 +1,8 @@
|
||||
[gd_scene format=3 uid="uid://bjyltbtx45cqs"]
|
||||
|
||||
[node name="BulletTraceDistance" type="Node3D"]
|
||||
|
||||
[node name="Start" type="Node3D" parent="."]
|
||||
|
||||
[node name="End" type="Node3D" parent="."]
|
||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -300)
|
26
godot/scenes/weapon/misc/bullet_trail_generic.gd
Normal file
26
godot/scenes/weapon/misc/bullet_trail_generic.gd
Normal file
@ -0,0 +1,26 @@
|
||||
extends MeshInstance3D
|
||||
|
||||
var alpha = 1.0
|
||||
func init(pos1, pos2):
|
||||
var draw_mesh := ImmediateMesh.new()
|
||||
mesh = draw_mesh
|
||||
draw_mesh.surface_begin(Mesh.PRIMITIVE_LINES, material_override)
|
||||
draw_mesh.surface_add_vertex(pos1)
|
||||
draw_mesh.surface_add_vertex(pos2)
|
||||
draw_mesh.surface_end()
|
||||
|
||||
# Called when the node enters the scene tree for the first time.
|
||||
func _ready() -> void:
|
||||
var dup_material = material_override.duplicate()
|
||||
material_override = dup_material
|
||||
pass # Replace with function body.
|
||||
|
||||
|
||||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta: float) -> void:
|
||||
alpha -= delta * 3.5
|
||||
material_override.albedo_color.a = alpha
|
||||
|
||||
|
||||
func _on_timer_timeout() -> void:
|
||||
queue_free()
|
24
godot/scenes/weapon/misc/bullet_trail_generic.tscn
Normal file
24
godot/scenes/weapon/misc/bullet_trail_generic.tscn
Normal file
@ -0,0 +1,24 @@
|
||||
[gd_scene load_steps=3 format=3 uid="uid://balgqtw1ijpw3"]
|
||||
|
||||
[ext_resource type="Script" path="res://scenes/weapon/misc/bullet_trail_generic.gd" id="1_k8eg1"]
|
||||
|
||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_ybqvs"]
|
||||
transparency = 1
|
||||
albedo_color = Color(0.300204, 0.908317, 1.54018e-06, 0.458824)
|
||||
emission_enabled = true
|
||||
emission = Color(0.454139, 0.861507, 0, 1)
|
||||
emission_energy_multiplier = 16.0
|
||||
distance_fade_min_distance = 2.0
|
||||
|
||||
[node name="BulletTrailGeneric" type="MeshInstance3D"]
|
||||
layers = 524288
|
||||
material_override = SubResource("StandardMaterial3D_ybqvs")
|
||||
visibility_range_end = 1891.27
|
||||
script = ExtResource("1_k8eg1")
|
||||
|
||||
[node name="Timer" type="Timer" parent="."]
|
||||
wait_time = 0.05
|
||||
one_shot = true
|
||||
autostart = true
|
||||
|
||||
[connection signal="timeout" from="Timer" to="." method="_on_timer_timeout"]
|
3
godot/scenes/weapon/misc/muzzle_flash.tscn
Normal file
3
godot/scenes/weapon/misc/muzzle_flash.tscn
Normal file
@ -0,0 +1,3 @@
|
||||
[gd_scene format=3 uid="uid://bfelcp5dmag5r"]
|
||||
|
||||
[node name="MuzzleFlash" type="MeshInstance3D"]
|
Reference in New Issue
Block a user