27 lines
707 B
GDScript
27 lines
707 B
GDScript
extends Camera3D
|
|
|
|
@export var cam_max_pan_speed = 0.5
|
|
@export var cam_max_zoom_speed = 2
|
|
|
|
func _process(delta: float) -> void:
|
|
move_camera()
|
|
|
|
func move_camera():
|
|
if Input.is_action_pressed("main_cam_up"):
|
|
position.z = position.z - cam_max_pan_speed
|
|
|
|
if Input.is_action_pressed("main_cam_right"):
|
|
position.x = position.x + cam_max_pan_speed
|
|
|
|
if Input.is_action_pressed("main_cam_down"):
|
|
position.z = position.z + cam_max_pan_speed
|
|
|
|
if Input.is_action_pressed("main_cam_left"):
|
|
position.x = position.x - cam_max_pan_speed
|
|
|
|
if Input.is_action_just_released("main_cam_in"):
|
|
fov = fov - cam_max_zoom_speed
|
|
|
|
if Input.is_action_just_released("main_cam_out"):
|
|
fov = fov + cam_max_zoom_speed
|