diff --git a/main.tscn b/main.tscn index 1f2dfe9..c74d95b 100644 --- a/main.tscn +++ b/main.tscn @@ -6,7 +6,7 @@ [ext_resource type="Texture2D" uid="uid://wdjmyv260he1" path="res://world/textures/grass.jpg" id="2_272bh"] [ext_resource type="PackedScene" uid="uid://of6tq8gpjxtu" path="res://gears/gear_pickup.tscn" id="3_lquwl"] [ext_resource type="PackedScene" uid="uid://bafl8q0r61xrg" path="res://gears/gear.tscn" id="4_7mycd"] -[ext_resource type="Texture2D" uid="uid://bkq72dydktldv" path="res://world/sky/kloofendal_48d_partly_cloudy_puresky_2k.hdr" id="8_5vw27"] +[ext_resource type="Texture2D" uid="uid://bkq72dydktldv" path="res://world/sky/sky.hdr" id="8_5vw27"] [sub_resource type="BoxShape3D" id="BoxShape3D_7dm0k"] size = Vector3(1000, 2, 1000) diff --git a/player/camera_gimbal.gd b/player/camera_gimbal.gd index 1e8713b..d870429 100644 --- a/player/camera_gimbal.gd +++ b/player/camera_gimbal.gd @@ -7,6 +7,9 @@ var locked_mouse_positon = Vector2(0,0) var mouse_locked = false var mouse_x_velocity = 0 var mouse_y_velocity = 0 +var zoom_min = 0 +var zoom_max = 100 +var current_zoom = 0 func reset(): basis = Basis() @@ -23,6 +26,10 @@ func _input(event): if event is InputEventMouseMotion: mouse_x_velocity = event.relative.x mouse_y_velocity = event.relative.y + elif event.is_action_pressed("zoom_in"): + current_zoom += 5 + elif event.is_action_pressed("zoom_out"): + current_zoom -= 5 func _process(delta): # rotate outer gimbal around y axis @@ -57,3 +64,6 @@ func _process(delta): # reset gimbals if Input.is_action_pressed("cam_reset"): reset() + + current_zoom = clamp(current_zoom,zoom_min,zoom_max) + $InnerGimbal/Camera3D.position = Vector3($InnerGimbal/Camera3D.position.x,current_zoom,current_zoom) diff --git a/project.godot b/project.godot index 7d21883..17ffc86 100644 --- a/project.godot +++ b/project.godot @@ -92,6 +92,16 @@ shift_lock={ "events": [Object(InputEventKey,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"pressed":false,"keycode":0,"physical_keycode":4194325,"key_label":0,"unicode":0,"location":0,"echo":false,"script":null) ] } +zoom_in={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":4,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} +zoom_out={ +"deadzone": 0.2, +"events": [Object(InputEventMouseButton,"resource_local_to_scene":false,"resource_name":"","device":-1,"window_id":0,"alt_pressed":false,"shift_pressed":false,"ctrl_pressed":false,"meta_pressed":false,"button_mask":0,"position":Vector2(0, 0),"global_position":Vector2(0, 0),"factor":1.0,"button_index":5,"canceled":false,"pressed":false,"double_click":false,"script":null) +] +} [layer_names] diff --git a/world/sky/kloofendal_48d_partly_cloudy_puresky_2k.hdr b/world/sky/sky.hdr similarity index 100% rename from world/sky/kloofendal_48d_partly_cloudy_puresky_2k.hdr rename to world/sky/sky.hdr