Compare commits
2 Commits
4256b2001f
...
ca898b0d09
| Author | SHA1 | Date | |
|---|---|---|---|
| ca898b0d09 | |||
| e013ef7875 |
@ -9,6 +9,9 @@ const DECELLERATION := 40.0
|
|||||||
const JUMP_SPEED := 4.0
|
const JUMP_SPEED := 4.0
|
||||||
const MAX_NUMBER_OF_JUMPS := 2
|
const MAX_NUMBER_OF_JUMPS := 2
|
||||||
|
|
||||||
|
const MIN_FOV := 10
|
||||||
|
const MAX_FOV := 180
|
||||||
|
const ZOOM_FACTOR := 1.1 # Zoom out when >1, in when < 1
|
||||||
var mouse_sensitivity := 0.005
|
var mouse_sensitivity := 0.005
|
||||||
var rotation_x := 0.0
|
var rotation_x := 0.0
|
||||||
var rotation_y := 0.0
|
var rotation_y := 0.0
|
||||||
@ -86,3 +89,14 @@ func _input(event):
|
|||||||
|
|
||||||
$Camera3D.rotation.x = rotation_x
|
$Camera3D.rotation.x = rotation_x
|
||||||
rotation.y = rotation_y
|
rotation.y = rotation_y
|
||||||
|
|
||||||
|
if event is InputEventMouseButton and event.pressed:
|
||||||
|
if event.button_index == MOUSE_BUTTON_WHEEL_UP:
|
||||||
|
zoom_camera(1.0 / ZOOM_FACTOR) # Zoom in
|
||||||
|
elif event.button_index == MOUSE_BUTTON_WHEEL_DOWN:
|
||||||
|
zoom_camera(ZOOM_FACTOR) # Zoom out
|
||||||
|
|
||||||
|
func zoom_camera(factor):
|
||||||
|
var new_fov = cam.fov * factor
|
||||||
|
cam.fov = clamp(new_fov, MIN_FOV, MAX_FOV)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user