I have a moving game object with rigidbody and box collider. I have set up another box collider in the way of its path and want to make the moving object rotate 90 degrees when it goes through the box collider.
despite many attempts nothing works I have also tried using OnCollisionEnter . this is my code.
using UnityEngine;
using System.Collections;
public class tilts : MonoBehaviour {
void OnTriggerEnter (Collider collision)
{
if(collision.gameObject.tag == "boxc")
{
transform.Rotate (0, 0, 90);
}
}
}