extends KinematicBody const SPEED = 20 var velocity = Vector3() # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. func get_player_input(delta): var cam_vec_lateral = $Camera.transform.basis.x var cam_vec_vertical = $Camera.transform.basis.y if Input.is_action_pressed("player_left"): velocity += SPEED * cam_vec_lateral * delta elif Input.is_action_pressed("player_right"): velocity += SPEED * -cam_vec_lateral * delta if Input.is_action_pressed("player_up"): velocity += SPEED * cam_vec_vertical * delta elif Input.is_action_pressed("player_down"): velocity += SPEED * -cam_vec_vertical * delta func _process(delta): # move foward according to the camera's POV var cam_vec_forward = $Camera.transform.basis.z velocity += SPEED * -cam_vec_forward * delta # get velocity changes player asks for get_player_input(delta) func _physics_process(_delta): velocity = move_and_slide(velocity, Vector3.UP)