Question by
TheGingerAvenger · Feb 10, 2018 at 03:35 AM ·
c#unity5platformer
How to kill player if his rotation is at a certain angle,How to kill player if his z rotation is more then 89
Basically I want the scene to reset whenever the player objects position is equal to or greater than 89 (so he is basically on his side at this point)
Sorry if this has been answered before but if it has I couldn't find it.
Here is my code:
using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.SceneManagement;
public class PlayerCollision : MonoBehaviour {
public GameObject player;
void Update () {
if (player.transform.rotation.eulerAngles.z > 85) {
SceneManager.LoadScene (SceneManager.GetActiveScene ().name);
}
}
}
Comment
Your answer
Follow this Question
Related Questions
error CS0117: `System.Console' does not contain a definition for `ReadKey' 0 Answers
GameObject fields evaluate to null, but they are actually assigned and working 1 Answer
Movement Unit (RTS) 0 Answers
Car from Unity's standard assets giving me of null reference errors 0 Answers
Player Movement - Not moving at all 3 Answers