other | The other Collider involved in this collision. |
OnTriggerEnter is called when the Collider other
enters the trigger.
This message is sent to the trigger Collider and the Rigidbody (if any) that the trigger Collider belongs
to, and to the Rigidbody (or the Collider if there is no Rigidbody) that touches the trigger.
Ten en cuenta que los eventos de colisión se envían sólo si al menos uno de los Colliders también tiene un Rigidbody no cinemático adjunto.
OnTriggerEnter occurs on the FixedUpdate after a collision. The Colliders involved are not guaranteed to be at the point of initial contact.
Note: OnTriggerEnter is not technically part of Collision. It is a MonoBehaviour function.
// Destroy everything that enters the trigger
function OnTriggerEnter (other : Collider) { Destroy(other.gameObject); }
using UnityEngine; using System.Collections;
public class ExampleClass : MonoBehaviour { void OnTriggerEnter(Collider other) { Destroy(other.gameObject); } }