Can't rotate PlayerController

Started by Zacoriot · 4 months ago · 1 reply · 87 views

edited 4 months ago#1
Zacoriot
Member
JoinedApr 2026 Posts1 Score435
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;
}

#2
bosinn
Member
JoinedDec 2023 Posts9 Score35
Please, always set explicitly access modifiers and don't name field and properties with _CamelCase 😢 Read microsoft coding convention
people
Log in to reply
You can't reply if you're not logged in. That would be crazy.