extends CharacterBody3D
var speed = 20
@onready var accel = 7
var direction = Vector3()
var movement = Vector3()
func _physics_process(delta):
##get keyboard input for moving
direction = Vector3.ZERO
var h_rot = global_transform.basis.get_euler().y
var f_input = Input.get_action_strength("Backward") - Input.get_action_strength("Forward")
var h_input = Input.get_action_strength("Right") - Input.get_action_strength("Left")
direction = Vector3(h_input, 0, f_input).rotated(Vector3(0, 1, 0), h_rot).normalized()
#make it move
velocity = velocity.lerp(direction * speed, accel * delta)
move_and_slide()
Sooo, WASD is already based on the direction, but I want to make controls so that you can fly up and down, but I don't know how to make this also directional. If you dont know what I mean, if you look down, and press up, it should move forward, but if you look down and press forward (W), it should move down.