I have 2 things in my project. A main character, and a enemy. My main have a Character Controller and a Third Person Controller script, a Rigidbody, and no Colliders [character controller has one]. My enemy have a box collider, and a script that say if my main character collide with him, it will do the “hit” animation, and will be “destroyed” right after. Not worked. After a lot of work, I discovered that the supposed problem is the ‘‘Character Controller’’ Collider does not work too good. What I supposed need to do is to erase the ‘‘third person controller’’, and the ‘‘character controller’’, but with myself, the ‘‘Third Person Controller’’ works very well with the Main Character movimentation. But I don’t want to make a new script to the character move with W,A,S,D, and make the determined animations that I have attached to it. What I can do to my ‘‘enemy’’ recognize the Collision?
#pragma strict
var idling:boolean=true;
functionStart(){
}
functionUpdate(){
if(idling)animation.Play("Principal");
}
functionOnCollisionEnter(collision:Collision)
{
if(collision.gameObject.tag =="Player")
{
animation.Stop();
idling =false;
animation.Play("Hit");
Destroy(gameObject,2);
}
}
Sorry for my horrible English, I’m Brazilian. Thnx for help!