From 03f96ab78f08e43f2f6f070644ce3fae60f48536 Mon Sep 17 00:00:00 2001 From: osquallo Date: Thu, 25 Apr 2019 22:48:24 +0200 Subject: [PATCH] Previewer: Ajout zoom via molette . --- previewer/previewer.gd | 7 ++++++- previewer/previewer.tscn | 8 ++++---- project.godot | 10 ++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/previewer/previewer.gd b/previewer/previewer.gd index f0e9001..286e2d5 100644 --- a/previewer/previewer.gd +++ b/previewer/previewer.gd @@ -22,4 +22,9 @@ func _input(event): 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 ) - \ No newline at end of file + + if event.is_action_pressed( "move_zoom_in" ): + $dummy/camera_stand/camera.set_fov( $dummy/camera_stand/camera.get_fov()-1.0 ) + elif event.is_action_pressed( "move_zoom_out" ): + $dummy/camera_stand/camera.set_fov( $dummy/camera_stand/camera.get_fov()+1.0 ) + \ No newline at end of file diff --git a/previewer/previewer.tscn b/previewer/previewer.tscn index 348479e..243588d 100644 --- a/previewer/previewer.tscn +++ b/previewer/previewer.tscn @@ -2,8 +2,8 @@ [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://meshes/props/travel_box/container.tscn" type="PackedScene" id=3] -[ext_resource path="res://meshes/props/pendo_teddy/pendo_teddy.tscn" type="PackedScene" id=4] +[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=4] [sub_resource type="ProceduralSky" id=1] @@ -54,10 +54,10 @@ mesh = SubResource( 6 ) [node name="props" type="Spatial" parent="."] -[node name="pendo_teddy" parent="props" instance=ExtResource( 4 )] +[node name="pendo_teddy" parent="props" instance=ExtResource( 3 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -3 ) -[node name="container" parent="props" instance=ExtResource( 3 )] +[node name="container" parent="props" instance=ExtResource( 4 )] transform = Transform( 1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -5 ) [node name="light_system" type="Spatial" parent="."] diff --git a/project.godot b/project.godot index 716990a..011af8d 100644 --- a/project.godot +++ b/project.godot @@ -46,6 +46,16 @@ move_look={ "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) ] } +move_zoom_out={ +"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":5,"pressed":false,"doubleclick":false,"script":null) + ] +} +move_zoom_in={ +"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":4,"pressed":false,"doubleclick":false,"script":null) + ] +} [node]