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