Made bullet tracer spawn bullet hit effects.
parent
1e2ec5120c
commit
b37c686602
|
@ -86,7 +86,6 @@ curve = SubResource( 6 )
|
|||
|
||||
[sub_resource type="ParticlesMaterial" id=8]
|
||||
lifetime_randomness = 0.65
|
||||
spread = 180.0
|
||||
initial_velocity = 10.0
|
||||
initial_velocity_random = 1.0
|
||||
damping = 7.82
|
||||
|
@ -116,9 +115,9 @@ gradient = SubResource( 11 )
|
|||
|
||||
[sub_resource type="ParticlesMaterial" id=13]
|
||||
lifetime_randomness = 0.34
|
||||
spread = 180.0
|
||||
initial_velocity = 10.0
|
||||
initial_velocity_random = 1.0
|
||||
spread = 35.0
|
||||
initial_velocity = 14.0
|
||||
initial_velocity_random = 0.7
|
||||
damping = 7.82
|
||||
damping_random = 0.92
|
||||
scale = 0.5
|
||||
|
@ -160,7 +159,7 @@ _data = [ Vector2( 0, 0.278253 ), 0.0, 1.12677, 0, 0, Vector2( 1, 1 ), 0.0, 0.0,
|
|||
curve = SubResource( 18 )
|
||||
|
||||
[sub_resource type="ParticlesMaterial" id=20]
|
||||
spread = 180.0
|
||||
spread = 30.0
|
||||
gravity = Vector3( 0, 0, 0 )
|
||||
initial_velocity = 5.0
|
||||
initial_velocity_random = 0.2
|
||||
|
@ -205,28 +204,34 @@ mesh = SubResource( 5 )
|
|||
material/0 = null
|
||||
|
||||
[node name="ParticlesDust" type="Particles" parent="."]
|
||||
transform = Transform( -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0 )
|
||||
emitting = false
|
||||
amount = 128
|
||||
lifetime = 2.0
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
local_coords = false
|
||||
process_material = SubResource( 8 )
|
||||
draw_pass_1 = SubResource( 10 )
|
||||
|
||||
[node name="ParticlesSparks" type="Particles" parent="."]
|
||||
transform = Transform( -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0 )
|
||||
emitting = false
|
||||
amount = 32
|
||||
lifetime = 2.0
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
local_coords = false
|
||||
process_material = SubResource( 13 )
|
||||
draw_pass_1 = SubResource( 15 )
|
||||
|
||||
[node name="ParticlesSmoke" type="Particles" parent="."]
|
||||
transform = Transform( -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, 0, 1, 0, 0, 0 )
|
||||
emitting = false
|
||||
lifetime = 4.0
|
||||
one_shot = true
|
||||
explosiveness = 1.0
|
||||
local_coords = false
|
||||
process_material = SubResource( 20 )
|
||||
draw_pass_1 = SubResource( 22 )
|
||||
|
||||
|
|
|
@ -3,6 +3,8 @@ extends Spatial
|
|||
var first = true
|
||||
var velocity = 200
|
||||
|
||||
const bullet_hit = preload("res://Assets/Effects/BulletHit.tscn")
|
||||
|
||||
func _ready():
|
||||
translate_object_local(Vector3(-10,0,0))
|
||||
set_process(true)
|
||||
|
@ -10,9 +12,22 @@ func _ready():
|
|||
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
||||
func _process(delta):
|
||||
translate_object_local(Vector3(-velocity * delta,0,0))
|
||||
if $RayCast.is_colliding():
|
||||
if $RayCast.get_collider() is Player:
|
||||
queue_free()
|
||||
else:
|
||||
var bullet_hit_effect = bullet_hit.instance()
|
||||
bullet_hit_effect.global_translate($RayCast.get_collision_point())
|
||||
#bullet_hit_effect.global_transform *= bullet_hit_effect.global_transform.looking_at($RayCast.get_collision_point() + $RayCast.get_collision_normal(), Vector3.UP)
|
||||
get_tree().root.call_deferred("add_child", bullet_hit_effect)
|
||||
queue_free()
|
||||
|
||||
const casing = preload("res://Assets/Weapons/Handgun/Casing.gd")
|
||||
|
||||
func _on_Raycast_body_entered(body):
|
||||
if not (body is Player) and not (body is casing):
|
||||
queue_free()
|
||||
#var bullet_hit_effect = bullet_hit.instance()
|
||||
#bullet_hit_effect.global_transform =
|
||||
#get_tree().root.call_deferred("add_child")
|
||||
|
||||
|
|
|
@ -10,9 +10,15 @@ length = 3.0
|
|||
[node name="BulletTracer" type="Spatial"]
|
||||
script = ExtResource( 1 )
|
||||
|
||||
[node name="RayCast" type="RayCast" parent="."]
|
||||
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 0, 0.001 )
|
||||
enabled = true
|
||||
cast_to = Vector3( -10, 0, 0 )
|
||||
|
||||
[node name="Raycast" type="Area" parent="."]
|
||||
transform = Transform( -1.62417e-07, 0, -0.996909, 0, 0.996909, 0, 0.996909, 0, -1.62417e-07, 2.816, -2.38419e-07, 0.000590307 )
|
||||
input_ray_pickable = false
|
||||
monitoring = false
|
||||
monitorable = false
|
||||
|
||||
[node name="CollisionShape" type="CollisionShape" parent="Raycast"]
|
||||
|
|
Reference in New Issue