29 lines
591 B
GDScript
29 lines
591 B
GDScript
extends Camera
|
|
|
|
var velocity = Vector3(0, 0, 0)
|
|
var camera_moving = false
|
|
|
|
func _physics_process(delta):
|
|
self.transform.origin += velocity * delta
|
|
|
|
func _unhandled_input(event):
|
|
if Input.get_mouse_button_mask() & 3:
|
|
camera_moving = true
|
|
else:
|
|
camera_moving = false
|
|
|
|
if event is InputEventKey:
|
|
if Input.is_action_pressed("Forward"):
|
|
velocity.z = -5
|
|
elif Input.is_action_pressed("Back"):
|
|
velocity.z = 5
|
|
else:
|
|
velocity.z = 0
|
|
|
|
if Input.is_action_pressed("Left"):
|
|
velocity.x = -5
|
|
elif Input.is_action_pressed("Right"):
|
|
velocity.x = 5
|
|
else:
|
|
velocity.x = 0
|