I am making a simple game where you shoot a fireball at a sphere monster that follows you. My code for the collision and the monster's following is this:
var thing : Transform;
var speed : float = 3.0;
function OnControllerColliderHit(hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "Fireball")
{
Debug.Log("hit");
transform.Destroy(gameObject);
}
}
function Update ()
{
transform.LookAt(thing);
transform.Translate(Vector3.forward * (speed * Time.deltaTime));
}
it doesn't destroy the monster and it doesn't say hit when i play the game and shoot at the monster. I made sure everything that needs it has colliders and everything else works (except for the fact that the monster goes through the terrain's hills)