konkr_game_3d/scripts/Camera.gd
ProgramSnail 5408d75267 init
2023-08-09 23:12:19 +03:00

19 lines
649 B
GDScript

extends Camera
export var speed = 10
export var zoom_speed = 0.6
func _process(delta):
if Input.is_action_pressed("camera_forward"):
global_translate(Vector3(-delta * speed, 0, 0))
if Input.is_action_pressed("camera_backward"):
global_translate(Vector3(delta * speed, 0, 0))
if Input.is_action_pressed("camera_left"):
global_translate(Vector3(0, 0, delta * speed))
if Input.is_action_pressed("camera_right"):
global_translate(Vector3(0, 0, -delta * speed))
if Input.is_action_just_released("zoom_in"):
translate(Vector3(0, 0, -zoom_speed))
if Input.is_action_just_released("zoom_out"):
translate(Vector3(0, 0, zoom_speed))
pass