I have next script:
extends CharacterBody3D
func _ready():
pass
func _process(delta):
if Input.is_action_just_pressed("ui_end"):
var from = global_transform.origin + (-global_transform.basis.z)
var to = global_transform.origin + global_transform.basis.z
print("from= ", global_transform.origin, " + ", (-global_transform.basis.z), " = ", from)
print("to= ", global_transform.origin, " + ", (global_transform.basis.z), " = ", to)
print("Conc: from ", from, " to ", to)
var progress = from.lerp(to, delta * 2)
print("Progress ", progress)
look_at(progress, global_transform.basis.y)
print("Rezult ", global_transform.origin + (-global_transform.basis.z))
And this is my console output:
from= (0, 0, 0) + (0, 0, -1) = (0, 0, -1)
to= (0, 0, 0) + (0, 0, 1) = (0, 0, 1)
Conc: from (0, 0, -1) to (0, 0, 1)
Progress (0, 0, -0.933333)
Rezult (0, 0, -1)
As you se rotation not changed after look_at call. But if lerp weight set to 1 CharacterBody3D rotated well and complete to other direction
So there is some screenshots of A - scene in editor, B - with lerp weight = 0.079325, C - with lerp weight = 1