Rigidbody
- AddExplosionForce
- AddForceAtPosition
- AddForce
- AddRelativeForce
- AddRelativeTorque
- AddTorque
- angularDrag
- angularVelocity
- centerOfMass
- ClosestPointOnBounds
- collisionDetectionMode
- detectCollisions
- drag
- freezeRotation
- GetPointVelocity
- GetRelativePointVelocity
- inertiaTensorRotation
- inertiaTensor
- interpolation
- isKinematic
- IsSleeping
- mass
- maxAngularVelocity
- MovePosition
- MoveRotation
- OnCollisionEnter
- OnCollisionExit
- OnCollisionStay
- position
- rotation
- SetDensity
- sleepAngularVelocity
- sleepVelocity
- Sleep
- solverIterationCount
- SweepTestAll
- SweepTest
- useConeFriction
- useGravity
- velocity
- WakeUp
- worldCenterOfMass
Rigidbody.useGravity 使用重力
var useGravity : bool
Description描述
Controls whether gravity affects this rigidbody.
控制重力是否影响整个刚体。
If set to false the rigidbody will behave as in outer space.
如果设置为false,刚体将不受重力影响。
using UnityEngine;
using System.Collections;
public class example : MonoBehaviour {
void OnTriggerEnter(Collider other) {
if (other.attachedRigidbody)
other.attachedRigidbody.useGravity = false;
}
public void Awake() {
collider.isTrigger = true;
}
}
// Disables gravity on all rigid bodies entering this collider.
//当所有刚体进入这个碰撞器,禁用重力
function OnTriggerEnter (other : Collider) {
if (other.attachedRigidbody) {
other.attachedRigidbody.useGravity = false;
}
}
// Turn this collider into a trigger on startup
//启动时把碰撞器变为触发器
collider.isTrigger = true;
最后修改:2011年1月29日 Saturday 16:17