I have a third person character that I move relative to the camera.
But I also want him to look into the direction he is going, but I don't know how.
var input_dir := Input.get_vector("move_left", "move_right", "move_forward", "move_backward")
var direction := (camera.transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
if direction:
# Attempt 1
player.look_at(direction, Vector3.UP, true)
# Attempt 2
player.rotation.y = lerpf(player.rotation.y, atan2(direction.x, direction.z), 0.3)
# Attempt 3
var new_transform = player.transform.looking_at(direction, Vector3.UP, true)
player.transform = player.transform.interpolate_with(new_transform, 0.9)
# Attempt 4
var new_transform = player.transform.looking_at(direction, Vector3.UP, true)
player.transform = new_transform
#1, #3 and #4 turn 180 degree and then immediatelly back the first time I start walking. They also have extreme slow rotations.
They probably never reach the wanted rotation.
#2. Works best but at a certain rotation it does a 360 rotation
Is the direction made from the camera.transform the issue?