Add 2D sprite at center of flag

This is a placeholder for the future shine effect
This commit is contained in:
Fabien Freling 2018-08-09 14:01:41 +02:00
parent 3706fa6774
commit 0adef2f250
3 changed files with 80 additions and 3 deletions

View file

@ -1067,3 +1067,7 @@ scene={
"nodes/root_type": "Spatial",
"nodes/storage": 0
}
[rendering]
environment/default_environment="res://levels/Level_01_env.tres"

View file

@ -5,4 +5,10 @@ func _ready():
func collided(body):
if body.has_method("reach_goal"):
body.reach_goal()
body.reach_goal()
# Should be done in vertex shader
#func _process(delta):
# var camera_pos = get_viewport().get_camera().global_transform.origin
# camera_pos.y = 0
# look_at(camera_pos, Vector3(0, 1, 0))

View file

@ -1,17 +1,52 @@
[gd_scene load_steps=4 format=2]
[gd_scene load_steps=8 format=2]
[ext_resource path="res://models/flag.glb" type="PackedScene" id=1]
[ext_resource path="res://scenes/Goal.gd" type="Script" id=2]
[sub_resource type="BoxShape" id=1]
extents = Vector3( 0.584547, 2.22627, 0.659734 )
[sub_resource type="Shader" id=6]
code = "shader_type spatial;
// TODO: Billboard effect
//void vertex() {
// UV=UV*uv1_scale.xy+uv1_offset.xy;
// MODELVIEW_MATRIX = INV_CAMERA_MATRIX * mat4(CAMERA_MATRIX[0],WORLD_MATRIX[1],vec4(normalize(cross(CAMERA_MATRIX[0].xyz,WORLD_MATRIX[1].xyz)),0.0),WORLD_MATRIX[3]);
//}
void fragment() {
ALBEDO = vec3(1.0, 0.0, 0.0); // use red for material albedo;
}
"
[sub_resource type="ShaderMaterial" id=7]
render_priority = 0
shader = SubResource( 6 )
[sub_resource type="Gradient" id=4]
offsets = PoolRealArray( 0, 1 )
colors = PoolColorArray( 0, 0, 0, 1, 1, 1, 1, 1 )
[sub_resource type="GradientTexture" id=5]
flags = 4
gradient = SubResource( 4 )
width = 2
_sections_unfolded = [ "Resource" ]
[node name="Scene Root" index="0" instance=ExtResource( 1 )]
script = ExtResource( 2 )
[node name="Pole" parent="." index="0"]
editor/display_folded = true
[node name="Flag" parent="Pole" index="0"]
transform = Transform( 5, 0, 0, 0, -4.37114e-08, -0.5, 0, 1, -2.18557e-08, 4.02201, 0.453122, 0 )
@ -60,4 +95,36 @@ transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.2251, 0 )
shape = SubResource( 1 )
disabled = false
[node name="Sprite3D" type="Sprite3D" parent="." index="4"]
transform = Transform( 250, 0, 0, 0, 500, 0, 0, 0, 1, 0, 0, 0 )
layers = 1
material_override = SubResource( 7 )
cast_shadow = 1
extra_cull_margin = 0.0
use_in_baked_light = false
lod_min_distance = 0.0
lod_min_hysteresis = 0.0
lod_max_distance = 0.0
lod_max_hysteresis = 0.0
centered = true
offset = Vector2( 0, 0 )
flip_h = false
flip_v = false
modulate = Color( 1, 1, 1, 1 )
opacity = 1.0
pixel_size = 0.01
axis = 2
transparent = true
shaded = false
double_sided = true
alpha_cut = 0
texture = SubResource( 5 )
vframes = 1
hframes = 1
frame = 0
region_enabled = false
region_rect = Rect2( 0, 0, 0, 0 )
_sections_unfolded = [ "Animation", "Flags", "Geometry", "LOD", "Pause", "Region", "Transform", "Visibility" ]