5 var velocity = Vector3()
7 # Called when the node enters the scene tree for the first time.
9 pass # Replace with function body.
11 func get_player_input(delta):
12 var cam_vec_lateral = $Camera.transform.basis.x
13 var cam_vec_vertical = $Camera.transform.basis.y
16 if Input.is_action_pressed("player_left"):
17 velocity += SPEED * cam_vec_lateral * delta
18 elif Input.is_action_pressed("player_right"):
19 velocity += SPEED * -cam_vec_lateral * delta
21 if Input.is_action_pressed("player_up"):
22 velocity += SPEED * cam_vec_vertical * delta
23 elif Input.is_action_pressed("player_down"):
24 velocity += SPEED * -cam_vec_vertical * delta
28 # move foward according to the camera's POV
29 var cam_vec_forward = $Camera.transform.basis.z
30 velocity += SPEED * -cam_vec_forward * delta
32 # get velocity changes player asks for
33 get_player_input(delta)
35 func _physics_process(_delta):
36 velocity = move_and_slide(velocity, Vector3.UP)