Missile with Exhaust Effects

Created a missile model with 4 exhausts in Blender and imported it with collision shapes (not tested yet if they work).
Created an exhaust shader with a simple particle trail. The shader that creates the exhaust flame can be adapted to the missile burn power.
main
Peery 2 years ago
parent 7c86284ca8
commit 8b25efe822

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

@ -0,0 +1,37 @@
[remap]
importer="texture"
type="StreamTexture"
path.s3tc="res://.import/missile_albedo.png-2cb94eaa9de484fd50d1215f51f806b4.s3tc.stex"
path.etc2="res://.import/missile_albedo.png-2cb94eaa9de484fd50d1215f51f806b4.etc2.stex"
metadata={
"imported_formats": [ "s3tc", "etc2" ],
"vram_texture": true
}
[deps]
source_file="res://assets/entities/missile/missile_albedo.png"
dest_files=[ "res://.import/missile_albedo.png-2cb94eaa9de484fd50d1215f51f806b4.s3tc.stex", "res://.import/missile_albedo.png-2cb94eaa9de484fd50d1215f51f806b4.etc2.stex" ]
[params]
compress/mode=2
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=true
flags/filter=true
flags/mipmaps=true
flags/anisotropic=false
flags/srgb=1
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=false
svg/scale=1.0

@ -14,6 +14,10 @@ config/name="GeneticMayham"
run/main_scene="res://scenes/space.tscn" run/main_scene="res://scenes/space.tscn"
config/icon="res://icon.png" config/icon="res://icon.png"
[global]
viewport=false
[gui] [gui]
common/drop_mouse_on_gui_input_disabled=true common/drop_mouse_on_gui_input_disabled=true

@ -1,10 +1,10 @@
extends Position3D extends Position3D
var maxX = 10 var maxX = 20
var minX = -10 var minX = -20
var SPEED = 1 var SPEED = 10
var state = -1 var state = -1

@ -0,0 +1,15 @@
extends Area
onready var turret_main = get_node("../../../../")
var seen_nodes = []
func body_entered(body: Node):
print(body.name+" just entered the vision!")
seen_nodes.append(body)
func body_exited(body: Node):
seen_nodes.remove(body)
func _ready():
pass

@ -0,0 +1,19 @@
extends Spatial
onready var exhaust_node = $Exhaust;
var exhausts = ["Exhaust", "Exhaust2", "Exhaust3", "Exhaust4"]
func change_engine_power(power):
var MAX_POWER = 10;
print("Changing missile exhaust to: ", power);
for e in exhausts:
var node: MeshInstance = exhaust_node.get_node("./"+e);
node.get_active_material(0).set_shader_param("power", clamp(power, .0, MAX_POWER));
func _ready():
pass;
#change_engine_power(10);

@ -0,0 +1,136 @@
[gd_scene load_steps=13 format=2]
[ext_resource path="res://assets/entities/missile/missile.glb" type="PackedScene" id=1]
[ext_resource path="res://assets/entities/missile/missile_albedo.png" type="Texture" id=2]
[ext_resource path="res://scenes/entities/missile.gd" type="Script" id=3]
[ext_resource path="res://scenes/entities/missiles/missile_exhaust.gdshader" type="Shader" id=4]
[sub_resource type="SpatialMaterial" id=2]
albedo_texture = ExtResource( 2 )
metallic = 1.0
roughness = 0.41
[sub_resource type="CapsuleShape" id=1]
height = 10.1286
[sub_resource type="ShaderMaterial" id=8]
shader = ExtResource( 4 )
shader_param/ANIM_SPEED = 100.0
shader_param/hot_color = Color( 0.9, 0.9, 9, 0.5 )
shader_param/cold_color = Color( 1, 1, 1, 0 )
shader_param/power = 1.0
[sub_resource type="SphereMesh" id=9]
material = SubResource( 8 )
radius = 0.35
height = 0.5
radial_segments = 128
rings = 64
[sub_resource type="ParticlesMaterial" id=3]
emission_shape = 1
emission_sphere_radius = 0.25
gravity = Vector3( 0, 40, 0 )
[sub_resource type="Shader" id=5]
code = "shader_type spatial;
render_mode depth_draw_opaque, unshaded, shadows_disabled;
uniform float MIX = 1.;
uniform float particle_alpha: hint_range(0.0, 1.0) = 1.0;
uniform vec4 top_color: hint_color = vec4(.2, .5, .8, 0.3);
uniform vec4 bot_color: hint_color = vec4(.2, .5, .8, 1);
void fragment() {
vec4 exhaust_color = mix(top_color, bot_color, .5);
ALPHA = exhaust_color.a;
ALBEDO = exhaust_color.rgb;
}
"
[sub_resource type="ShaderMaterial" id=6]
shader = SubResource( 5 )
shader_param/MIX = 1.0
shader_param/particle_alpha = 1.0
shader_param/top_color = Color( 0.2, 0.5, 0.8, 0.3 )
shader_param/bot_color = Color( 0.2, 0.5, 0.8, 1 )
[sub_resource type="SphereMesh" id=4]
material = SubResource( 6 )
radius = 0.025
height = 0.05
radial_segments = 32
rings = 16
[node name="missile" instance=ExtResource( 1 )]
script = ExtResource( 3 )
[node name="missile body" parent="." index="0"]
material/0 = SubResource( 2 )
[node name="RigidBody" type="RigidBody" parent="." index="1"]
[node name="CollisionShape" type="CollisionShape" parent="RigidBody" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0.371096 )
shape = SubResource( 1 )
[node name="Exhaust" type="Spatial" parent="." index="2"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -4.901 )
[node name="Exhaust" type="MeshInstance" parent="Exhaust" index="0"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.5, 0.5, 0.1 )
mesh = SubResource( 9 )
[node name="Particles" type="Particles" parent="Exhaust/Exhaust" index="0"]
visible = false
cast_shadow = 0
amount = 50
lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
process_material = SubResource( 3 )
draw_pass_1 = SubResource( 4 )
[node name="Exhaust2" type="MeshInstance" parent="Exhaust" index="1"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.5, 0.5, 0.1 )
mesh = SubResource( 9 )
skeleton = NodePath("../Exhaust")
[node name="Particles" type="Particles" parent="Exhaust/Exhaust2" index="0"]
visible = false
cast_shadow = 0
amount = 50
lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
process_material = SubResource( 3 )
draw_pass_1 = SubResource( 4 )
[node name="Exhaust3" type="MeshInstance" parent="Exhaust" index="2"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0.5, -0.5, 0.1 )
mesh = SubResource( 9 )
skeleton = NodePath("../Exhaust2")
[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 )
visible = false
cast_shadow = 0
amount = 50
lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
process_material = SubResource( 3 )
draw_pass_1 = SubResource( 4 )
[node name="Exhaust4" type="MeshInstance" parent="Exhaust" index="3"]
transform = Transform( 1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, -0.5, -0.5, 0.1 )
mesh = SubResource( 9 )
skeleton = NodePath(".")
[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 )
visible = false
cast_shadow = 0
amount = 50
lifetime = 3.0
visibility_aabb = AABB( nan, 0.05694, -7.38708, 0.867362, 0.904675, 14.7742 )
process_material = SubResource( 3 )
draw_pass_1 = SubResource( 4 )

@ -0,0 +1,20 @@
shader_type spatial;
uniform float ANIM_SPEED = 100.0;
uniform vec4 hot_color: hint_color = vec4(.9, .9, 9., .5);
uniform vec4 cold_color: hint_color = vec4(1., 1., 1., 0.);
uniform float power = 1.;
void vertex() {
float distance = sqrt(pow(VERTEX.z, 2) + pow(VERTEX.x, 2));
VERTEX.y = min(sin(VERTEX.x * TIME * ANIM_SPEED) * power / (distance * 10. + 1.), 0.);
vec4 exhaust_color = mix(hot_color, cold_color, VERTEX.y / 5.8);
COLOR = exhaust_color;
}
void fragment() {
ALPHA = COLOR.a;
ALBEDO = COLOR.rgb;
}

@ -10,12 +10,11 @@ onready var turret_yaw_bone = skeleton.find_bone("turret head")
onready var turret_pitch_bone = skeleton.find_bone("vertical joint") onready var turret_pitch_bone = skeleton.find_bone("vertical joint")
onready var vert_eyes = $VertEyes onready var vert_eyes = $VertEyes
onready var turret_eyes = $Armature/Skeleton/turretAttachement/TurretEyes onready var turret_eyes = $Armature/Skeleton/turretAttachement/TurretEyes
onready var vision_shape = $Armature/Skeleton/turretAttachement/TurretVision
var first_call: bool = true var first_call: bool = true
var target: Position3D var target: Position3D
#var additional_rotation = Vector3(90, 0, 0)
func _set_lookAtTarget_path(new_value): func _set_lookAtTarget_path(new_value):
# Because get_node doesn't work in the first call, we just want to assign instead. # Because get_node doesn't work in the first call, we just want to assign instead.
# This is to get around a issue with NodePaths exposed to the editor. # This is to get around a issue with NodePaths exposed to the editor.
@ -41,8 +40,11 @@ func _set_lookAtTarget_path(new_value):
else: else:
print("Railgun.gd: Got no LookAtTarget: ", LookAtTarget) print("Railgun.gd: Got no LookAtTarget: ", LookAtTarget)
func get_seen_entities() -> Array:
return vision_shape.seen_nodes
func _ready(): func _ready():
pass # configuring skeletonIK pass
func _process(delta): func _process(delta):

@ -1,7 +1,8 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=9 format=2]
[ext_resource path="res://assets/entities/railgun/railgun.glb" type="PackedScene" id=1] [ext_resource path="res://assets/entities/railgun/railgun.glb" type="PackedScene" id=1]
[ext_resource path="res://scenes/entities/railgun.gd" type="Script" id=2] [ext_resource path="res://scenes/entities/railgun.gd" type="Script" id=2]
[ext_resource path="res://scenes/entities/TurretVision.gd" type="Script" id=3]
[sub_resource type="PrismMesh" id=2] [sub_resource type="PrismMesh" id=2]
@ -13,6 +14,9 @@ albedo_color = Color( 0.956863, 0.635294, 0.635294, 1 )
[sub_resource type="SphereMesh" id=8] [sub_resource type="SphereMesh" id=8]
material = SubResource( 7 ) material = SubResource( 7 )
[sub_resource type="ConvexPolygonShape" id=9]
points = PoolVector3Array( 0, 0, 0, 1000, 1000, -2000, -1000, -1000, -2000, 1000, -1000, -2000, -1000, 1000, -2000 )
[node name="railgun" instance=ExtResource( 1 )] [node name="railgun" instance=ExtResource( 1 )]
script = ExtResource( 2 ) script = ExtResource( 2 )
@ -41,6 +45,21 @@ transform = Transform( 0.1, -1.50996e-08, -8.74228e-08, -1.50996e-08, -0.1, -4.3
transform = Transform( 1, -8.5412e-22, -1.73472e-18, -2.71051e-20, -4.37114e-09, 70, 7.10543e-15, -0.1, -3.0598e-06, 1.3415e-11, 69.095, 0 ) transform = Transform( 1, -8.5412e-22, -1.73472e-18, -2.71051e-20, -4.37114e-09, 70, 7.10543e-15, -0.1, -3.0598e-06, 1.3415e-11, 69.095, 0 )
mesh = SubResource( 8 ) mesh = SubResource( 8 )
[node name="Camera" type="Camera" parent="Armature/Skeleton/turretAttachement" index="1"]
transform = Transform( 1, -4.06819e-08, 2.32835e-07, -2.35538e-08, 0.963022, 0.269424, -2.35186e-07, -0.269424, 0.963022, 1.09829e-06, 4.65912, 7.27367 )
[node name="MeshInstance" type="MeshInstance" parent="Armature/Skeleton/turretAttachement/Camera" index="0"]
visible = false
mesh = SubResource( 2 )
skin = SubResource( 3 )
[node name="TurretVision" type="Area" parent="Armature/Skeleton/turretAttachement" index="2"]
script = ExtResource( 3 )
[node name="CollisionShape" type="CollisionShape" parent="Armature/Skeleton/turretAttachement/TurretVision" index="0"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 6.23837e-08, 1.04241, 0.413149 )
shape = SubResource( 9 )
[node name="AnimationPlayer" type="AnimationPlayer" parent="." index="1"] [node name="AnimationPlayer" type="AnimationPlayer" parent="." index="1"]
[node name="VertEyes" type="Spatial" parent="." index="2"] [node name="VertEyes" type="Spatial" parent="." index="2"]
@ -50,5 +69,6 @@ __meta__ = {
} }
[node name="MeshInstance" type="MeshInstance" parent="VertEyes" index="0"] [node name="MeshInstance" type="MeshInstance" parent="VertEyes" index="0"]
visible = false
mesh = SubResource( 2 ) mesh = SubResource( 2 )
skin = SubResource( 3 ) skin = SubResource( 3 )

@ -0,0 +1,23 @@
[gd_scene load_steps=3 format=2]
[sub_resource type="SphereMesh" id=1]
radius = 0.2
height = 0.2
radial_segments = 32
rings = 16
[sub_resource type="CapsuleShape" id=2]
radius = 0.13991
height = 0.16003
[node name="Projectile" type="Spatial"]
[node name="MeshInstance" type="MeshInstance" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 0.5, 0, 0, 0 )
mesh = SubResource( 1 )
[node name="RigidBody" type="RigidBody" parent="."]
[node name="CollisionShape" type="CollisionShape" parent="RigidBody"]
transform = Transform( -4.37114e-08, 0, 1, 0, 1, 0, -1, 0, -4.37114e-08, 0, 0, 0 )
shape = SubResource( 2 )

@ -0,0 +1,16 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=2]
[sub_resource type="Shader" id=2]
code = "shader_type spatial;
void vertex() {
VERTEX.x += NORMAL.x * sin(40. * VERTEX.x) / 5.;
}
void fragment() {
ALBEDO = vec3(.2, .6, .8);
ROUGHNESS = .5;
}"
[resource]
shader = SubResource( 2 )

@ -1,8 +1,9 @@
[gd_scene load_steps=7 format=2] [gd_scene load_steps=8 format=2]
[ext_resource path="res://assets/environment/skyboxes/nebula_space/panorama_image.png" type="Texture" id=1] [ext_resource path="res://assets/environment/skyboxes/nebula_space/panorama_image.png" type="Texture" id=1]
[ext_resource path="res://scenes/entities/railgun.tscn" type="PackedScene" id=2] [ext_resource path="res://scenes/entities/railgun.tscn" type="PackedScene" id=2]
[ext_resource path="res://scenes/entities/DebugLookAtTarget.gd" type="Script" id=3] [ext_resource path="res://scenes/entities/DebugLookAtTarget.gd" type="Script" id=3]
[ext_resource path="res://scenes/entities/missile.tscn" type="PackedScene" id=4]
[sub_resource type="PanoramaSky" id=1] [sub_resource type="PanoramaSky" id=1]
panorama = ExtResource( 1 ) panorama = ExtResource( 1 )
@ -25,12 +26,15 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 7.50682, 0, -7.59585 )
LookAtTarget = NodePath("LookAtTarget2") LookAtTarget = NodePath("LookAtTarget2")
[node name="LookAtTarget2" type="Position3D" parent="entities/railgun"] [node name="LookAtTarget2" type="Position3D" parent="entities/railgun"]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.694, 4.553 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 8.694, 29.5299 )
script = ExtResource( 3 ) script = ExtResource( 3 )
[node name="MeshInstance" type="MeshInstance" parent="entities/railgun/LookAtTarget2"] [node name="MeshInstance" type="MeshInstance" parent="entities/railgun/LookAtTarget2"]
mesh = SubResource( 3 ) mesh = SubResource( 3 )
[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 )
[node name="lighting" type="Node" parent="."] [node name="lighting" type="Node" parent="."]
[node name="main_light" type="DirectionalLight" parent="lighting"] [node name="main_light" type="DirectionalLight" parent="lighting"]
@ -43,4 +47,5 @@ light_color = Color( 0.411765, 0.854902, 0.92549, 1 )
light_energy = 0.2 light_energy = 0.2
[node name="Camera" type="Camera" parent="."] [node name="Camera" type="Camera" parent="."]
transform = Transform( 0.8208, 0.16956, -0.545469, 0, 0.954927, 0.296842, 0.571215, -0.243648, 0.783804, -4.41776, 10.7973, 11.901 ) transform = Transform( -0.916363, 0.11884, -0.382304, 0, 0.954927, 0.296842, 0.400349, 0.272015, -0.875059, -4.41776, 10.7973, -27.9208 )
current = true

Loading…
Cancel
Save