Heya!
Just a quick one, as I am not sure if I am going about this the correct way. I am trying to set my players position and rotation to a given Vector3 and Quaternion provided and stored by a checkpoint.
void Respawn(GameObject player)
{
if( _MyRagdoll != null)
{
_MyRagdoll.Destroy();
}
_MyRagdoll = player.GetComponent<PlayerController>().CreateRagdoll();
player.WorldPosition = _Position;
player.WorldRotation = _Rotation;
}My issue is that my player teleports to the correct position but does not rotate properly and retains the original look direction.
I have tried enabling and disabling the: player game object; PlayerController Component to no avail
If anyone has any advice that would be great! :)
edited:
SOLVED: I had to rotate the camera to get around the issue:
void Respawn(GameObject player)
{
if( _MyRagdoll != null)
{
_MyRagdoll.Destroy();
}
_MyRagdoll = player.GetComponent<PlayerController>().CreateRagdoll();
player.WorldPosition = _Position;
Scene.Camera.WorldRotation = _Rotation;
}