Rigidbody
extends Component
The RigidBody class is mainly used for the physical simulation of game objects, adding physical effects to game objects.
During runtime, you can obtain the RigidBody component object using the following method:
typescript
let obj = new GameObject();
let rigid = obj.AddComponent<RigidBody>(RigidBody);成员变量
Rigidbody.isSleeping : boolean |
| (Read Only) Whether the Rigidbody is sleeping. |
Rigidbody.solverIterations : number |
| The number of iterations used by the physics engine when solving positions. |
Rigidbody.useGravity : boolean |
| Whether the rigidbody is affected by gravity. |
Rigidbody.isKinematic : boolean |
| Whether the rigidbody is enabled for physics simulation. |
Rigidbody.freezeRotation : boolean |
Rigidbody.detectCollisions : boolean |
| Whether to enable collision detection. |
Rigidbody.interpolation : RigidbodyInterpolation |
| How to perform object interpolation. |
Rigidbody.centerOfMass : Vector3 |
| The position of the center of mass of the Rigidbody. |
Rigidbody.mass : number |
| The mass of the rigidbody. |
Rigidbody.solverVelocityIterations : number |
| The number of iterations used by the physics engine to calculate the velocity of rigid bodies. |
Rigidbody.drag : number |
| The air resistance experienced by a rigid body in motion. |
Rigidbody.angularDrag : number |
| Angular drag of the object. |
Rigidbody.sleepThreshold : number |
| The velocity threshold at which a rigidbody enters sleep mode. |
Rigidbody.maxAngularVelocity : number |
| The maximum angular velocity of the rigidbody. |
Rigidbody.maxLinearVelocity : number |
| The maximum linear velocity of the Rigidbody. |
Rigidbody.worldCenterOfMass : Vector3 |
| (Read Only) The center of mass position of the Rigidbody in world space. |
Rigidbody.maxDepenetrationVelocity : number |
| The maximum velocity for resolving penetration of a Rigidbody. |
Rigidbody.position : Vector3 |
| Position of the Rigidbody. |
Rigidbody.velocity : Vector3 |
| The velocity vector of the Rigidbody. |
Rigidbody.angularVelocity : Vector3 |
| Angular velocity vector of the rigidbody. |
Rigidbody.inertiaTensor : Vector3 |
| The inertia tensor of this object. |
Rigidbody.rotation : Quaternion |
| Rotation of the Rigidbody. |
Rigidbody.inertiaTensorRotation : Quaternion |
| The rotation of the inertia tensor of the object. |
Rigidbody.raints : RigidbodyConstraints |
| Controls the simulation degrees of freedom for this Rigidbody. |
Rigidbody.collisionDetectionMode : CollisionDetectionMode |
| Collision detection mode of a Rigidbody. |
Rigidbody.density : void |
| (Set Only) Sets the mass based on the attached collider. |
成员方法
Rigidbody.AddExplosionForce ( explosionForce : number , explosionPosition : Vector3 , explosionRadius : number , upwardsModifier : number , mode : ForceMode ) : void |
| Applies a force to rigidbodies to simulate an explosion effect. |
Rigidbody.AddRelativeTorque ( torque : Vector3 , mode : ForceMode ) : void |
| Adds a torque to the rigidbody relative to its coordinate system. |
Rigidbody.ClosestPointOnBounds ( position : Vector3 ) : ClosestPoint |
| Returns the squared distance and coordinates of the point on the closest Rigidbody bounding box to the specified point. |
Rigidbody.GetPointVelocity ( value : Vector3 ) : Vector3 |
| The velocity vector of a Rigidbody at a specific point in world coordinates. |
Rigidbody.AddForce ( force : Vector3 , mode : ForceMode ) : void |
| Add force to a Rigidbody. |
Rigidbody.MovePosition ( value : Vector3 ) : void |
| Move the position of the Rigidbody. |
Rigidbody.AddForceAtPosition ( force : Vector3 , position : Vector3 , mode : ForceMode ) : void |
| Apply force at a specified position. |
Rigidbody.AddRelativeForce ( force : Vector3 , mode : ForceMode ) : void |
| Add a force to the Rigidbody in its local coordinate system. |
Rigidbody.AddTorque ( torque : Vector3 , mode : ForceMode ) : void |
| Add torque to a Rigidbody. |
Rigidbody.GetRelativePointVelocity ( value : Vector3 ) : Vector3 |
| The relative velocity of a given point on the rigidbody. |
Rigidbody.MoveRotation ( value : Quaternion ) : void |
| Rotates the angle of a rigidbody. |
Rigidbody.ResetCenterOfMass ( ) : void |
| Reset the center of mass of the Rigidbody. |
Rigidbody.ResetInertiaTensor ( ) : void |
| Reset the inertia tensor value and rotation. |
Rigidbody.Sleep ( ) : void |
| Rigidbody Sleeping |
Rigidbody.WakeUp ( ) : void |
| Wakes up the Rigidbody. |
Rigidbody.SweepTest ( direction : Vector3 , maxDistance : number? ) : RaycastHit|undefined |
| Test if the rigidbody will collide with any objects when moving in the scene. |
