Collider.OnTriggerExit 退出触发器
function OnTriggerExit (other : Collider) : void
Description描述
OnTriggerExit is called when the Collider other has stopped touching the trigger.
当碰撞器other停止触动触发器时,OnTriggerExit被调用。也就是说,
当碰撞器离开触发器时,调用OnTriggerExit。
This message is sent to the trigger collider and the rigidbody (or the collider if there is no rigidbody) that touches the trigger. Note that trigger events are only sent if one of the colliders also has a rigidbody attached.
这个消息是发送给触动触发器的碰撞器和刚体(或如果没有刚体的碰撞器)。注意假如一个碰撞物体同时带有一个刚体属性
那么只发送这个触发事件。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnTriggerExit(Collider other) {
Destroy(other.gameObject);
}
}
// Destroy everything that leaves the trigger
//离开触发器时,销毁所有物体
function OnTriggerExit (other : Collider) {
Destroy(other.gameObject);
}
最后修改:2010年12月12日 Sunday 15:25