31 lines
1.0 KiB
GDScript
31 lines
1.0 KiB
GDScript
extends Camera3D
|
|
@export var movespeed: float
|
|
@export var rotatespeed: float
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
if Input.is_action_pressed("W"):
|
|
self.position += global_transform.basis.y*movespeed*delta
|
|
if Input.is_action_pressed("S"):
|
|
self.position += global_transform.basis.y*-movespeed*delta
|
|
if Input.is_action_pressed("A"):
|
|
self.position += global_transform.basis.x*-movespeed*delta
|
|
if Input.is_action_pressed("D"):
|
|
self.position += global_transform.basis.x*movespeed*delta
|
|
if Input.is_action_pressed("zoom in"):
|
|
self.position += Vector3(0,-movespeed*delta,0)
|
|
if Input.is_action_pressed("zoom out"):
|
|
self.position += Vector3(0,movespeed*delta,0)
|
|
|
|
if Input.is_action_pressed("rotate right"):
|
|
self.rotation += Vector3(0,-rotatespeed*delta,0)
|
|
if Input.is_action_pressed("rotate left"):
|
|
self.rotation += Vector3(0,rotatespeed*delta,0)
|
|
|
|
pass
|