Use Blender pole as Goal

This commit is contained in:
Fabien Freling 2018-07-19 15:37:14 +02:00
parent bf2fc48c3e
commit ba190a34c3
8 changed files with 1127 additions and 80 deletions

8
Goal.gd Normal file
View file

@ -0,0 +1,8 @@
extends Spatial
func _ready():
get_node("Area").connect("body_entered", self, "collided")
func collided(body):
if body.has_method("reach_goal"):
body.reach_goal()

113
Goal.tscn
View file

@ -1,79 +1,50 @@
[gd_scene load_steps=3 format=2] [gd_scene load_steps=4 format=2]
[sub_resource type="CylinderMesh" id=1] [ext_resource path="res://models/flag.glb" type="PackedScene" id=1]
[ext_resource path="res://Goal.gd" type="Script" id=2]
top_radius = 1.0 [sub_resource type="BoxShape" id=1]
bottom_radius = 1.0
height = 2.0
radial_segments = 64
rings = 4
[sub_resource type="SpatialMaterial" id=2] extents = Vector3( 1, 1, 1 )
render_priority = 0 [node name="Scene Root" instance=ExtResource( 1 )]
flags_transparent = false
flags_unshaded = false
flags_vertex_lighting = false
flags_no_depth_test = false
flags_use_point_size = false
flags_world_triplanar = false
flags_fixed_size = false
flags_albedo_tex_force_srgb = false
vertex_color_use_as_albedo = false
vertex_color_is_srgb = false
params_diffuse_mode = 0
params_specular_mode = 0
params_blend_mode = 0
params_cull_mode = 0
params_depth_draw_mode = 0
params_line_width = 1.0
params_point_size = 1.0
params_billboard_mode = 0
params_grow = false
params_use_alpha_scissor = false
albedo_color = Color( 0.938139, 0.992188, 0.00387573, 1 )
metallic = 0.0
metallic_specular = 0.5
metallic_texture_channel = 0
roughness = 0.0
roughness_texture_channel = 0
emission_enabled = false
normal_enabled = false
rim_enabled = false
clearcoat_enabled = false
anisotropy_enabled = false
ao_enabled = false
depth_enabled = false
subsurf_scatter_enabled = false
transmission_enabled = false
refraction_enabled = false
detail_enabled = false
uv1_scale = Vector3( 1, 1, 1 )
uv1_offset = Vector3( 0, 0, 0 )
uv1_triplanar = false
uv1_triplanar_sharpness = 1.0
uv2_scale = Vector3( 1, 1, 1 )
uv2_offset = Vector3( 0, 0, 0 )
uv2_triplanar = false
uv2_triplanar_sharpness = 1.0
proximity_fade_enable = false
distance_fade_enable = false
_sections_unfolded = [ "Refraction" ]
[node name="MeshInstance" type="MeshInstance" index="0"] script = ExtResource( 2 )
layers = 1 [node name="Lamp" parent="." index="2"]
material_override = null
cast_shadow = 1 visible = false
extra_cull_margin = 0.0
use_in_baked_light = false [node name="Camera" parent="." index="3"]
lod_min_distance = 0.0
lod_min_hysteresis = 0.0 visible = false
lod_max_distance = 0.0
lod_max_hysteresis = 0.0 [node name="Area" type="Area" parent="." index="4"]
mesh = SubResource( 1 )
skeleton = NodePath("..") input_ray_pickable = false
material/0 = SubResource( 2 ) input_capture_on_drag = false
_sections_unfolded = [ "material" ] space_override = 0
gravity_point = false
gravity_distance_scale = 0.0
gravity_vec = Vector3( 0, -1, 0 )
gravity = 9.8
linear_damp = 0.1
angular_damp = 1.0
priority = 0.0
monitoring = true
monitorable = true
collision_layer = 1
collision_mask = 1
audio_bus_override = false
audio_bus_name = "Master"
reverb_bus_enable = false
reverb_bus_name = "Master"
reverb_bus_amount = 0.0
reverb_bus_uniformity = 0.0
[node name="CollisionShape" type="CollisionShape" parent="Area" index="0"]
shape = SubResource( 1 )
disabled = false

View file

@ -1,8 +1,8 @@
[gd_scene load_steps=4 format=2] [gd_scene load_steps=4 format=2]
[ext_resource path="res://mlib.meshlib" type="MeshLibrary" id=1] [ext_resource path="res://mlib.meshlib" type="MeshLibrary" id=1]
[ext_resource path="res://Goal.tscn" type="PackedScene" id=2] [ext_resource path="res://Player.tscn" type="PackedScene" id=2]
[ext_resource path="res://Player.tscn" type="PackedScene" id=3] [ext_resource path="res://Goal.tscn" type="PackedScene" id=3]
[node name="Node" type="Node" index="0"] [node name="Node" type="Node" index="0"]
@ -18,7 +18,7 @@ cell_scale = 1.0
collision_layer = 1 collision_layer = 1
collision_mask = 1 collision_mask = 1
data = { data = {
"cells": PoolIntArray( 0, 0, 1441792, 65534, 0, 1441792, 65535, 0, 1441792, 0, 65534, 1612054528, 65534, 65534, 1441792, 65535, 65534, 1441792, 0, 65535, 1441792, 65534, 65535, 1441792 ) "cells": PoolIntArray( 0, 0, 1441792, 65534, 0, -1609170944, 65535, 0, 1441792, 0, 65534, 1441792, 65534, 65534, 538312704, 65535, 65534, 1441792, 0, 65535, 1441792, 65534, 65535, 1441792 )
} }
_sections_unfolded = [ "Cell", "Collision", "Transform", "Visibility" ] _sections_unfolded = [ "Cell", "Collision", "Transform", "Visibility" ]
__meta__ = { __meta__ = {
@ -26,10 +26,6 @@ __meta__ = {
"_editor_floor_": Vector3( 0, 1, 0 ) "_editor_floor_": Vector3( 0, 1, 0 )
} }
[node name="MeshInstance" parent="GridMap" index="0" instance=ExtResource( 2 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 3, 1 )
[node name="Camera" type="Camera" parent="." index="1"] [node name="Camera" type="Camera" parent="." index="1"]
transform = Transform( 1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 6, 7 ) transform = Transform( 1, 0, 0, 0, 0.939693, 0.34202, 0, -0.34202, 0.939693, 0, 6, 7 )
@ -47,9 +43,13 @@ near = 0.05
far = 100.0 far = 100.0
_sections_unfolded = [ "Transform" ] _sections_unfolded = [ "Transform" ]
[node name="Player" parent="." index="2" instance=ExtResource( 3 )] [node name="Player" parent="." index="2" instance=ExtResource( 2 )]
transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 3.48439, -2.72332 ) transform = Transform( 0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, -2.88637, 3.48439, -2.72332 )
_sections_unfolded = [ "Transform" ] _sections_unfolded = [ "Transform" ]
[node name="Goal" parent="." index="3" instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 3, 1 )

View file

@ -39,3 +39,6 @@ func _process(delta):
# Called every frame. Delta is time since last frame. # Called every frame. Delta is time since last frame.
# Update game logic here. # Update game logic here.
pass pass
func reach_goal():
print("Reached goal")

View file

@ -27,7 +27,7 @@ void fragment() {
render_priority = 0 render_priority = 0
shader = SubResource( 3 ) shader = SubResource( 3 )
[node name="Player" type="KinematicBody" index="0"] [node name="Player" type="KinematicBody"]
input_ray_pickable = true input_ray_pickable = true
input_capture_on_drag = false input_capture_on_drag = false

BIN
models/flag.blend Normal file

Binary file not shown.

BIN
models/flag.glb Normal file

Binary file not shown.

1065
models/flag.glb.import Normal file

File diff suppressed because it is too large Load diff