Missile Exhaust Cutoff Point

The change_engine_power() function in the missile root node hides the entire engine exhausts when the power is set to 0.
main
Peery 2 years ago
parent 8b25efe822
commit d393ab1150

@ -3,17 +3,24 @@ extends Spatial
onready var exhaust_node = $Exhaust; onready var exhaust_node = $Exhaust;
var exhausts = ["Exhaust", "Exhaust2", "Exhaust3", "Exhaust4"]
func change_engine_power(power): func change_engine_power(power):
var MAX_POWER = 10; var MAX_POWER = 10;
var exhausts = ["Exhaust", "Exhaust2", "Exhaust3", "Exhaust4"];
print("Changing missile exhaust to: ", power); print("Changing missile exhaust to: ", power);
for e in exhausts: for e in exhausts:
var node: MeshInstance = exhaust_node.get_node("./"+e); var node: MeshInstance = exhaust_node.get_node("./"+e);
node.get_active_material(0).set_shader_param("power", clamp(power, .0, MAX_POWER)); node.get_active_material(0).set_shader_param("power", clamp(power, .0, MAX_POWER));
var particle_node: Particles = node.get_node("./Particles");
if power < 2.0:
if power == 0.0:
node.set_visible(false);
particle_node.set_emitting(false);
else:
node.set_visible(true);
particle_node.set_emitting(true);
func _ready(): func _ready():
pass; change_engine_power(0.0);
#change_engine_power(10);

@ -83,8 +83,9 @@ transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.5, 0.
mesh = SubResource( 9 ) mesh = SubResource( 9 )
[node name="Particles" type="Particles" parent="Exhaust/Exhaust" index="0"] [node name="Particles" type="Particles" parent="Exhaust/Exhaust" index="0"]
visible = false transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0 )
cast_shadow = 0 cast_shadow = 0
emitting = false
amount = 50 amount = 50
lifetime = 3.0 lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 ) visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
@ -97,8 +98,9 @@ mesh = SubResource( 9 )
skeleton = NodePath("../Exhaust") skeleton = NodePath("../Exhaust")
[node name="Particles" type="Particles" parent="Exhaust/Exhaust2" index="0"] [node name="Particles" type="Particles" parent="Exhaust/Exhaust2" index="0"]
visible = false transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0 )
cast_shadow = 0 cast_shadow = 0
emitting = false
amount = 50 amount = 50
lifetime = 3.0 lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 ) visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
@ -112,8 +114,8 @@ skeleton = NodePath("../Exhaust2")
[node name="Particles" type="Particles" parent="Exhaust/Exhaust3" index="0"] [node name="Particles" type="Particles" parent="Exhaust/Exhaust3" index="0"]
transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0 ) transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0 )
visible = false
cast_shadow = 0 cast_shadow = 0
emitting = false
amount = 50 amount = 50
lifetime = 3.0 lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 ) visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
@ -127,8 +129,8 @@ skeleton = NodePath(".")
[node name="Particles" type="Particles" parent="Exhaust/Exhaust4" index="0"] [node name="Particles" type="Particles" parent="Exhaust/Exhaust4" index="0"]
transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0 ) transform = Transform( 1, 0, 0, 0, -1, 8.74228e-08, 0, -8.74228e-08, -1, 0, 0, 0 )
visible = false
cast_shadow = 0 cast_shadow = 0
emitting = false
amount = 50 amount = 50
lifetime = 3.0 lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 ) visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )

@ -33,7 +33,7 @@ script = ExtResource( 3 )
mesh = SubResource( 3 ) mesh = SubResource( 3 )
[node name="missile" parent="entities" instance=ExtResource( 4 )] [node name="missile" parent="entities" instance=ExtResource( 4 )]
transform = Transform( -0.446495, 0, -0.894786, 0, 1, 0, 0.894786, 0, -0.446495, -7.21845, 8.26498, -24.0157 ) transform = Transform( 0.860022, 0, -0.510258, 0, 1, 0, 0.510258, 0, 0.860022, -2.93378, 8.26498, -11.9562 )
[node name="lighting" type="Node" parent="."] [node name="lighting" type="Node" parent="."]

Loading…
Cancel
Save