Compare commits
1 commit
4e8b397948
...
1fd43ac5f9
| Author | SHA1 | Date | |
|---|---|---|---|
| 1fd43ac5f9 |
2 changed files with 20 additions and 0 deletions
|
|
@ -7,6 +7,9 @@ var locked_mouse_positon = Vector2(0,0)
|
||||||
var mouse_locked = false
|
var mouse_locked = false
|
||||||
var mouse_x_velocity = 0
|
var mouse_x_velocity = 0
|
||||||
var mouse_y_velocity = 0
|
var mouse_y_velocity = 0
|
||||||
|
var zoom_min = 4
|
||||||
|
var zoom_max = 100
|
||||||
|
var current_zoom = 8
|
||||||
|
|
||||||
func reset():
|
func reset():
|
||||||
basis = Basis()
|
basis = Basis()
|
||||||
|
|
@ -23,6 +26,10 @@ func _input(event):
|
||||||
if event is InputEventMouseMotion:
|
if event is InputEventMouseMotion:
|
||||||
mouse_x_velocity = event.relative.x
|
mouse_x_velocity = event.relative.x
|
||||||
mouse_y_velocity = event.relative.y
|
mouse_y_velocity = event.relative.y
|
||||||
|
elif event.is_action_pressed("zoom_out"):
|
||||||
|
current_zoom += 5
|
||||||
|
elif event.is_action_pressed("zoom_in"):
|
||||||
|
current_zoom -= 5
|
||||||
|
|
||||||
func _process(delta):
|
func _process(delta):
|
||||||
# rotate outer gimbal around y axis
|
# rotate outer gimbal around y axis
|
||||||
|
|
@ -56,3 +63,6 @@ func _process(delta):
|
||||||
# reset gimbals
|
# reset gimbals
|
||||||
if Input.is_action_pressed("cam_reset"):
|
if Input.is_action_pressed("cam_reset"):
|
||||||
reset()
|
reset()
|
||||||
|
|
||||||
|
current_zoom = clamp(current_zoom, zoom_min, zoom_max)
|
||||||
|
$InnerGimbal/Camera3D.position = Vector3($InnerGimbal/Camera3D.position.x, current_zoom, current_zoom)
|
||||||
|
|
|
||||||
|
|
@ -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)
|
"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]
|
[layer_names]
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue