RComley/Collisions

From ETC Public Wiki
Jump to: navigation, search

Check this page out for collider rigidbody combos:

http://unity3d.com/support/documentation/Components/class-SphereCollider.html

Simple trigger script

 function OnTriggerEnter(other:Collider)  {
   // check the other objects tag to see what we hit
   if(other.gameObject.CompareTag("Enemy"))  {
     // send a message to the other object
     other.gameObject.SendMessage("OnHit");
     // destroy this object
     Destroy(gameObject);
   }
 }