Rigidbody
继承自 Component
RigidBody类主要用于游戏对象的物理模拟,为游戏对象添加物理效果。
在运行过程中,可以使用以下方式来获取RigidBody组件对象:
typescript
let obj = new GameObject();
let rigid = obj.AddComponent<Rigidbody>(Rigidbody);成员变量
成员方法
Rigidbody.AddExplosionForce ( explosionForce : number , explosionPosition : Vector3 , explosionRadius : number , upwardsModifier : number , mode : ForceMode ) : void |
| 对模拟爆炸效果的刚体施加力。 |
Rigidbody.AddRelativeTorque ( torque : Vector3 , mode : ForceMode ) : void |
| 给刚体添加一个相对于其坐标系的扭矩。 |
Rigidbody.ClosestPointOnBounds ( position : Vector3 ) : ClosestPoint |
| 返回到指定点最近的刚体包围盒上的点的平方距离与坐标。 |
Rigidbody.GetPointVelocity ( value : Vector3 ) : Vector3 |
| 刚体在世界坐标中特定点的速度向量。 |
Rigidbody.AddForce ( force : Vector3 , mode : ForceMode ) : void |
| 向刚体添加力。 |
Rigidbody.MovePosition ( value : Vector3 ) : void |
| 移动刚体位置。 |
Rigidbody.AddForceAtPosition ( force : Vector3 , position : Vector3 , mode : ForceMode ) : void |
| 在指定位置上施加力。 |
Rigidbody.AddRelativeForce ( force : Vector3 , mode : ForceMode ) : void |
| 给刚体添加一个本地坐标系的力。 |
Rigidbody.AddTorque ( torque : Vector3 , mode : ForceMode ) : void |
| 向刚体添加扭矩。 |
Rigidbody.GetRelativePointVelocity ( value : Vector3 ) : Vector3 |
| 刚体上给定点的相对速度。 |
Rigidbody.MoveRotation ( value : Quaternion ) : void |
| 旋转刚体的角度。 |
Rigidbody.ResetCenterOfMass ( ) : void |
| 重置刚体的质心。 |
Rigidbody.ResetInertiaTensor ( ) : void |
| 重置惯性张量值和旋转。 |
Rigidbody.Sleep ( ) : void |
| 刚体休眠。 |
Rigidbody.WakeUp ( ) : void |
| 唤醒刚体。 |
Rigidbody.SweepTest ( direction : Vector3 , maxDistance : number? ) : RaycastHit|undefined |
| 测试如果刚体在场景中移动时,是否会与任何对象发生碰撞。 |
