Rotation on teleport with InVector

I wanted to teleport the controller to a given position with a given rotation. When I tried it, the position worked, but the controller kept the same rotation it had before the teleport. It was correct for a frame, then changed back.

Here’s the code that fixed it:

public void Teleport(Transform teleportPoint)
{
    transform.position = teleportPoint.position;
    transform.forward = teleportPoint.forward;
    // Stop inVector from spinning the player back again.
_inVectorInputHandler.ResetCameraAngleWithoutSmooth();
}

Leave a Comment

Your email address will not be published. Required fields are marked *

Auto
Scroll to Top