2020-03-01 23:18:15 +00:00
|
|
|
extends Camera
|
|
|
|
|
2020-03-19 15:57:31 +00:00
|
|
|
const TRANSLATION_SPEED : float = 0.1
|
|
|
|
const ROTATION_SPEED : float = 0.025
|
2020-03-01 23:18:15 +00:00
|
|
|
|
|
|
|
func _physics_process(delta : float) -> void:
|
|
|
|
if Input.is_action_pressed("camera_forward"):
|
2020-03-19 15:57:31 +00:00
|
|
|
translate(TRANSLATION_SPEED * Vector3(0, 0, -1))
|
2020-03-01 23:18:15 +00:00
|
|
|
if Input.is_action_pressed("camera_backward"):
|
2020-03-19 15:57:31 +00:00
|
|
|
translate(TRANSLATION_SPEED * Vector3(0, 0, 1))
|
2020-03-01 23:18:15 +00:00
|
|
|
if Input.is_action_pressed("camera_strafe_up"):
|
2020-03-19 15:57:31 +00:00
|
|
|
translate(TRANSLATION_SPEED * Vector3(0, 1, 0))
|
2020-03-01 23:18:15 +00:00
|
|
|
if Input.is_action_pressed("camera_strafe_down"):
|
2020-03-19 15:57:31 +00:00
|
|
|
translate(TRANSLATION_SPEED * Vector3(0, -1, 0))
|
2020-03-01 23:18:15 +00:00
|
|
|
if Input.is_action_pressed("camera_strafe_right"):
|
2020-03-19 15:57:31 +00:00
|
|
|
translate(TRANSLATION_SPEED * Vector3(1, 0, 0))
|
2020-03-01 23:18:15 +00:00
|
|
|
if Input.is_action_pressed("camera_strafe_left"):
|
2020-03-19 15:57:31 +00:00
|
|
|
translate(TRANSLATION_SPEED * Vector3(-1, 0, 0))
|
|
|
|
if Input.is_action_pressed("camera_pitch_down"):
|
|
|
|
rotate_object_local(Vector3(1,0,0), -ROTATION_SPEED)
|
|
|
|
if Input.is_action_pressed("camera_pitch_up"):
|
|
|
|
rotate_object_local(Vector3(1,0,0), ROTATION_SPEED)
|
|
|
|
if Input.is_action_pressed("camera_roll_left"):
|
|
|
|
rotate_object_local(Vector3(0,0,1), ROTATION_SPEED)
|
|
|
|
if Input.is_action_pressed("camera_roll_right"):
|
|
|
|
rotate_object_local(Vector3(0,0,1), -ROTATION_SPEED)
|
|
|
|
if Input.is_action_pressed("camera_yaw_left"):
|
|
|
|
rotate_object_local(Vector3(0,1,0), ROTATION_SPEED)
|
|
|
|
if Input.is_action_pressed("camera_yaw_right"):
|
|
|
|
rotate_object_local(Vector3(0,1,0), -ROTATION_SPEED)
|