I’m either really dumb, or there’s something seriously wrong.
I have what should be a super simple script; a coroutine which when started turns the alpha of a canvas group to 1, moves the player, rotates the player, and then fades the canvas group back out.
IEnumerator teleporter()
{
fader.FadeIn(transition);
yield return new WaitForSecondsRealtime(1f);
player.transform.position = destination.transform.position;
player.transform.rotation = destination.transform.rotation;
yield return new WaitForSecondsRealtime(1f);
fader.FadeOut(transition);
}
All of this works, and the player will move, except rotating the player to face in the new direction. It doesn’t do anything. I’ve tried just setting the rotation, as above. I’ve tried slerping with:
player.transform.rotation = Quaternion.Slerp(player.transform.rotation, destination.transform.rotation, Time.deltaTime);
I’ve tried disabling my MouseLook script while doing all of the above. I’ve tried using a bool and putting the rotate code in Update.
No matter what I do, the player gets moved to the new location but keeps looking in the direction they were looking when interacting with the object that runs that coroutine.