collider.oncollisionexit 退出碰撞

2015-1-4 17:47| 发布者: 杨炎| 查看: 1546| 评论: 0|原作者: 蛮牛|来自: yzc88亚洲城脚本manual

摘要: collider.oncollisionexit 退出碰撞functiononcollisionexit(collisioninfo:collision) : voiddescription描述oncollisionexit is called when this collider/rigidbody has stopped touching another rigidbody/col ...

collider.oncollisionexit 退出碰撞

functiononcollisionexit(collisioninfo:collision) : void

description描述

oncollisionexit is called when this collider/rigidbody has stopped touching another rigidbody/collider.

当 collider/rigidbody停止触动另一个 rigidbody/collider时,oncollisionexit被调用。

in contrast to ontriggerexit, oncollisionexit is passed thecollisionclass and not a collider. thecollisionclass contains information about contact points, impact velocity etc. if you don't use collisioninfo in the function, leave out the collisioninfo parameter as this avoids unneccessary calculations. note that collision events are only sent if one of the colliders also has a non-kinematic rigidbody attached.

相比ontriggerexit,oncollisionexit传递collision类而不是collider。collision类包含接触点,碰撞速度等信息。在这个函数如果你不使用collisioninfo,删去collisioninfo参数以避免不必要的计算。注意,当其中至少一个碰撞盒附加非动力学刚体时碰撞事件才会发送。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

void oncollisionexit(collisioncollisioninfo) {

print("no longer in contact with " + collisioninfo.transform.name);

}

}

function oncollisionexit(collisioninfo :collision) {

print("no longer in contact with " + collisioninfo.transform.name);

}

相关阅读

文章点评
相关文章