Previewer: Ajout rotation camera via clic droit.

This commit is contained in:
osquallo 2019-04-25 22:38:32 +02:00
parent 02270c15c1
commit 4d7dc2cc3a
8 changed files with 19 additions and 8 deletions

View file

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

View file

@ -7,6 +7,19 @@ func _process( delta ):
if Input.is_action_pressed("move_backward"): if Input.is_action_pressed("move_backward"):
$dummy/camera_stand.translate( Vector3( 0.0, 0.0, 10.0*delta ) ) $dummy/camera_stand.translate( Vector3( 0.0, 0.0, 10.0*delta ) )
if Input.is_action_pressed("move_left"): if Input.is_action_pressed("move_left"):
$dummy/camera_stand.rotate_y( 1.0*delta ) $dummy/camera_stand.translate( Vector3(-10.0*delta, 0.0, 0.0 ) )
if Input.is_action_pressed("move_right"): if Input.is_action_pressed("move_right"):
$dummy/camera_stand.rotate_y( -1.0*delta ) $dummy/camera_stand.translate( Vector3( 10.0*delta, 0.0, 0.0 ) )
func _input(event):
if event.is_action_pressed( "move_look" ):
Input.set_mouse_mode( Input.MOUSE_MODE_CAPTURED )
elif event.is_action_released( "move_look" ):
Input.set_mouse_mode( Input.MOUSE_MODE_VISIBLE )
if event is InputEventMouseMotion:
if Input.is_action_pressed( "move_look" ):
$dummy/camera_stand/camera.rotate_x( -event.relative.y * 0.01 )
$dummy/camera_stand.rotate_y( -event.relative.x * 0.01 )

View file

@ -2,8 +2,8 @@
[ext_resource path="res://previewer/previewer.gd" type="Script" id=1] [ext_resource path="res://previewer/previewer.gd" type="Script" id=1]
[ext_resource path="res://previewer/dummy/dummy.tscn" type="PackedScene" id=2] [ext_resource path="res://previewer/dummy/dummy.tscn" type="PackedScene" id=2]
[ext_resource path="res://meshes/props/pendo_teddy/pendo_teddy.tscn" type="PackedScene" id=3] [ext_resource path="res://meshes/props/travel_box/container.tscn" type="PackedScene" id=3]
[ext_resource path="res://meshes/props/travel_box/container.tscn" type="PackedScene" id=4] [ext_resource path="res://meshes/props/pendo_teddy/pendo_teddy.tscn" type="PackedScene" id=4]
[sub_resource type="ProceduralSky" id=1] [sub_resource type="ProceduralSky" id=1]
@ -54,10 +54,10 @@ mesh = SubResource( 6 )
[node name="props" type="Spatial" parent="."] [node name="props" type="Spatial" parent="."]
[node name="pendo_teddy" parent="props" instance=ExtResource( 3 )] [node name="pendo_teddy" parent="props" instance=ExtResource( 4 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3 )
[node name="container" parent="props" instance=ExtResource( 4 )] [node name="container" parent="props" instance=ExtResource( 3 )]
transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5 ) transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5 )
[node name="light_system" type="Spatial" parent="."] [node name="light_system" type="Spatial" parent="."]
@ -70,4 +70,3 @@ shadow_enabled = true
[node name="gi_probe" type="GIProbe" parent="light_system"] [node name="gi_probe" type="GIProbe" parent="light_system"]
extents = Vector3( 63.192, 10, 76.3229 ) extents = Vector3( 63.192, 10, 76.3229 )
data = SubResource( 7 ) data = SubResource( 7 )