function OnTriggerEnter doesn't work

Hi folks,

I wrote a Js for my character, but it doesn’t work for me. Don’t know what I did wrong. Maybe you can help me.

This is my Js;

var character : Transform;
var explosion : Transform;

function Start()
{
	explosion.gameObject.SetActive(false);
}

function OnTriggerEnter(other : Collider){
	if (other.gameObject.CompareTag("CharacterTag"))
    {    	
    	character.gameObject.SetActive(false);
    	explosion.position = character.position;
        explosion.rotation = character.rotation;
        explosion.gameObject.SetActive(true);
	}
}

I put this Js in an object and I tagged my character to “CharacterTag”. But when my character moves to that object. It does nothing. It just walk trough of that object. I added a Box Collider for my character and for that object. It just didn’t work.

Please someone who can help me with this problem?

Thanks in advance

Make sure “Is Trigger” of the collider is checked.

I give an answer on my own question for those who have the same problem. What I did was just a simple step. I added a RIGIDBODY to the character. And because I don’t want the character fall down, I just disabled “Use Gravity”. Hope this answer would help your problem.