collision.rigidbody 刚体

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

摘要: collision.rigidbody 刚体varrigidbody:rigidbodydescription描述therigidbodywe hit (read only). this is null if the object we hit is a collider with no rigidbody attached.我们碰撞的刚体(只读)。如果我们 ...

collision.rigidbody 刚体

varrigidbody:rigidbody

description描述

therigidbodywe hit (read only). this is null if the object we hit is a collider with no rigidbody attached.

我们碰撞的刚体(只读)。如果我们碰撞的物体是一个没有附加刚体的碰撞器,返回null。

c#

javascript

using unityengine;

using system.collections;

public class example :monobehaviour{

void oncollisionstay(collision collision) {

if (collision.rigidbody)

collision.rigidbody.addforce(vector3.up * 15);

}

}

// make all rigidbodies we touch fly upwards

//使我们接触的全部刚体向上飞

function oncollisionstay(collision : collision) {

// check if the collider we hit has a rigidbody

//检查如果我们接触的碰撞器是一个刚体

// then apply the force

//然后应用力。

if (collision.rigidbody) {

collision.rigidbody.addforce (vector3.up * 15);

}

}

相关阅读

文章点评
相关文章