I have a player that shoots a rocket. If the rocket has a target, I use a quaternion slerp to make it home in on that target. Free firing the rocket goes directly forwards as expected. Setting a
tracking_speed of 1 homes directly towards the target as expected. But for some reason if I set
tracking_speed to less than 1, the rocket's initial direction becomes (0 0, 1) no matter where the ship is pointing and then proceeds to rotate towards the target. Code below.
var transformed_rotation:Transform = global_transform.looking_at(target.global_transform.origin, Vector3.UP) var new_rotation:Quat = Quat(global_transform.basis).slerp(transformed_rotation.basis, tracking_speed) set_global_transform(Transform(new_rotation, global_transform.origin))