Compare commits

..

2 Commits

Author SHA1 Message Date
ca898b0d09 Merge remote-tracking branch 'origin/main' into LAWDev
# Conflicts:
#	scenes/player.gd
2025-11-07 17:13:00 -06:00
e013ef7875 Add camera zoom 2025-11-07 17:11:59 -06:00

View File

@ -9,6 +9,9 @@ const DECELLERATION := 40.0
const JUMP_SPEED := 4.0
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 rotation_x := 0.0
var rotation_y := 0.0
@ -86,3 +89,14 @@ func _input(event):
$Camera3D.rotation.x = rotation_x
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)