Hello,
How do I detect a collision with another Character Controller?
When my CharacterController Collider hits my enemies CharacterController with the script below there is no detection of hit.
If I use a box collider the script works fine. So my question is how would I get it to detect the Hit with another CharacterController to destroy that Enemy?
var EnemyDie : AudioClip;
var DisplayHitIcon : boolean = false;
var hitIcon : Texture2D;
function OnControllerColliderHit (hit : ControllerColliderHit)
{
if(hit.gameObject.tag == "enemyLevel1")
{
Debug.Log("***Enenmy is Destroyed***");
Destroy(hit.gameObject);
audio.PlayOneShot(EnemyDie);
DisplayHitIcon = true;
yield WaitForSeconds(.2);
DisplayHitIcon = false;
}
}
function OnGUI()
{
if(DisplayHitIcon)
{
GUI.Label (Rect (172, 50, 249,240), hitIcon, GUIStyle.none);
}
}