I can´t get this to work. The code I´ve borrowed from other solutions to rotate towards target always fail once I try to move the player.
The one that works best right now is the one from codetuto rotation tutorial, here´s my adaption:
if value < 1:
var t = player.get_transform()
var lookDir = target_pos - player_pos
var rotTransform = t.looking_at(lookDir,Vector3(0,1,0))
var thisRotation = Quat(t.basis).slerp(rotTransform.basis,value)
value += delta
if value>1:
value = 1
player.set_transform(Transform(thisRotation,t.origin))
elif value == 1:
player.move(playerFacing*delta*5)
this rotates first and then moves toward, but still ends up a little on the left side of the target, if I take away the conditional for player.move() then the player rotates to much, ends up to the right of the target, dipping like a boat...
Any help would be very much appreciated. Doesn´t have to be based upon the above code, I just want to learn how to make a smooth turn and move towards a target at the same time...