Game Object won't match rotation of new positions transform

(sorry if the title is at all confusing) Anyway… In my game if the player falls form a platform they lose a life and get placed back at the start of the level.

Using this code-

void OnTriggerEnter(Collider collider)
		if( == "Player")
			collider.gameObject.transform.position = levelStart.transform.position;
			LivesManager.lives -= livesValue; // Decrease Player Lives total


All works fine apart from I realised the player will get spawned facing whatever direction they were facing when they died. How can I make it so the player is always spawned facing the direction of the levelStart transform.


You can just set the rotation by using:

collider.gameObject.transform.rotation = levelStart.transform.rotation;

You’d only have to rotate the levelStart object to face the proper way.

If this method isn’t ideal for you game you can also just set the player rotation to a Quaternion specified in the inspector. Or use a Vector3 and Eulerangles.

Hope that helped :slight_smile: