找回密碼
 注冊帳號

掃一掃,訪問微社區

collider.ontriggerexit 退出觸發器

2015-1-4 18:17| 發布者: 楊炎| 查看: 3312| 評論: 0|原作者: 蠻牛|來自: unity3d腳本manual

摘要: collider.ontriggerexit 退出觸發器functionontriggerexit(other: collider) : voiddescription描述ontriggerexit is called when thecolliderother has stopped touching the trigger.當碰撞器other停止觸動觸發器 ...

collider.ontriggerexit 退出觸發

functionontriggerexit(other: collider) : void

description描述

ontriggerexit is called when thecolliderother 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.

這個消息是發送給觸發碰撞器和剛體(或如果沒有剛體的碰撞器)。注意如果其中一個碰撞器也附加了剛體,觸發事件才會發送。

c#

javascript

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);

}

相關閱讀

文章點評
相關文章
女校游泳队彩金