title: Checking rotation of door
body: <p>I have a tutorial scene set up, and at the end I have a resized cube with a door texture on it. I have set up the code to check for collisions and rotate it's pivot, but after the collision, the door rotates forever. Inside my <code>void OnCollisionEnter()</code>, I have an if statement:</p>
  
  <pre><code>if (pivot.transform.rotation.eulerAngles.y == 83)
  {
      pivot.GetComponent&lt;Rigidbody&gt;().freezeRotation = true;
  }
  </code></pre>
  
  <p>but it doesn't seem to work. Could anybody enlighten me on this? As I can't seem to find the answer.</p>
  
  <p>Here is the entire script:</p>
  
  <pre><code>using UnityEngine;
  using System.Collections;
  using UnityEngine.UI;
  
  public class DoorOpen : MonoBehaviour {
  
      public GameObject pivot;
  
  
      void Start () {
  
      }
  
      void Update () {
  
      }
  
      void OnCollisionEnter(Collision door)
      {
  
          if (door.collider.tag == "Door")
          {
              StartCoroutine(openDoor());
          }
  
      }
      IEnumerator openDoor() {
  
          float angle=0;
          for(int i=0 ;i&lt;=6;i++){
              angle+= i * 10;
              pivot.transform.eulerAngles = new Vector3(0f,83f,0f);
              yield return new WaitForSeconds(0.4f);
          }
  
      }
  }
  </code></pre>