Ajout d'un simple previewer pour se balader dans un decors.

This commit is contained in:
osquallo 2019-04-19 12:27:07 +02:00
parent 4581135c07
commit a5b67612d8
5 changed files with 85 additions and 1 deletions

View file

@ -5,4 +5,3 @@
[resource]
background_mode = 2
background_sky = SubResource( 1 )

View file

@ -0,0 +1,9 @@
[gd_scene format=2]
[node name="dummy" type="Spatial"]
[node name="camera_stand" type="Spatial" parent="."]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2, 0 )
[node name="camera" type="Camera" parent="camera_stand"]
current = true

12
previewer/previewer.gd Normal file
View file

@ -0,0 +1,12 @@
extends Spatial
func _process( delta ):
if Input.is_action_pressed("move_forward"):
$dummy/camera_stand.translate( Vector3( 0.0, 0.0,-10.0*delta ) )
if Input.is_action_pressed("move_backward"):
$dummy/camera_stand.translate( Vector3( 0.0, 0.0, 10.0*delta ) )
if Input.is_action_pressed("move_left"):
$dummy/camera_stand.rotate_y( 1.0*delta )
if Input.is_action_pressed("move_right"):
$dummy/camera_stand.rotate_y( -1.0*delta )

30
previewer/previewer.tscn Normal file
View file

@ -0,0 +1,30 @@
[gd_scene load_steps=7 format=2]
[ext_resource path="res://previewer/previewer.gd" type="Script" id=1]
[ext_resource path="res://previewer/dummy/dummy.tscn" type="PackedScene" id=2]
[sub_resource type="OpenSimplexNoise" id=1]
period = 0.1
persistence = 0.444
lacunarity = 0.1
[sub_resource type="NoiseTexture" id=2]
noise = SubResource( 1 )
[sub_resource type="SpatialMaterial" id=3]
albedo_color = Color( 0.192157, 0.435294, 0.172549, 1 )
albedo_texture = SubResource( 2 )
[sub_resource type="PlaneMesh" id=4]
material = SubResource( 3 )
[node name="previewer" type="Spatial"]
script = ExtResource( 1 )
[node name="dummy" parent="." instance=ExtResource( 2 )]
[node name="terrain" type="Spatial" parent="."]
[node name="test_csg_mesh" type="CSGMesh" parent="terrain"]
transform = Transform( 60.964, 0, 0, 0, 1.21928, 0, 0, 0, 60.964, 0, 0, 0 )
mesh = SubResource( 4 )

View file

@ -16,8 +16,42 @@ _global_script_class_icons={
[application]
config/name="Khanat assets"
run/main_scene="res://previewer/previewer.tscn"
config/icon="res://pirzba_color.png"
[input]
move_forward={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777232,"unicode":0,"echo":false,"script":null)
]
}
move_backward={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777234,"unicode":0,"echo":false,"script":null)
]
}
move_left={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777231,"unicode":0,"echo":false,"script":null)
]
}
move_right={
"deadzone": 0.5,
"events": [ Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"pressed":false,"scancode":16777233,"unicode":0,"echo":false,"script":null)
]
}
move_look={
"deadzone": 0.5,
"events": [ Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":0,"alt":false,"shift":false,"control":false,"meta":false,"command":false,"button_mask":0,"position":Vector2( 0, 0 ),"global_position":Vector2( 0, 0 ),"factor":1.0,"button_index":2,"pressed":false,"doubleclick":false,"script":null)
]
}
[node]
name_num_separator=2
name_casing=2
[rendering]
environment/default_environment="res://default_env.tres"