找回密码
 注册帐号

扫一扫,访问微社区

collider.ontriggerexit 退出触发器

2015-1-4 18:17| 发布者: 杨炎| 查看: 3351| 评论: 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);

}

相关阅读

文章点评
相关文章