Version: 2023.2
Language : English
Apply interpolation to a Rigidbody
Constant Force component reference

Rigidbody component reference

Switch to Scripting

Use the Rigidbody component to apply a Rigidbody to your GameObjectThe fundamental object in Unity scenes, which can represent characters, props, scenery, cameras, waypoints, and more. A GameObject’s functionality is defined by the Components attached to it. More info
See in Glossary
. A Rigidbody provides a physics-based way to control the movement and position of a GameObject. Instead of the Transform properties, you can use simulated physics forces and torque to move the GameObject, and let the physics engineA system that simulates aspects of physical systems so that objects can accelerate correctly and be affected by collisions, gravity and other forces. More info
See in Glossary
calculate the results. For more information, see Introduction to Rigidbody Physics.

To monitor the performance of a Rigidbody, use the Physics Debug Visualization tool.

Properties

Property Function
Mass Define the mass of the GameObject (in kilograms). Mass is set to 1 by default. As in real life, mass does not affect how quickly an item falls under gravity. To simulate resistance forces that slow down movement, use Drag.
Drag Define the decay rate of a Rigidbody’s linear velocity, to simulate drag, air resistance, or friction. Low values produce a slower decay rate, so that the GameObject moves faster for longer (this is useful for simulating heavy real-world objects). High values produce a faster decay rate, so that the GameObject slows down over a short amount of time (this is useful for simulating lightweight real-world objects).
Angular Drag Define the decay rate of a Rigidbody’s rotational velocity, to simulate drag, air resistance, or friction. Low values produce a slower decay rate, so that the GameObject moves faster for longer (this is useful for simulating heavy real-world objects). High values produce a faster decay rate, so that the GameObject slows down over a short amount of time (this is useful for simulating lightweight real-world objects). Note that you cannot make the GameObject stop rotating just by setting its Angular Drag to infinity. Angular Drag is set to 0.05 by default.
Automatic Center Of MassRepresents the average position of all mass in a Rigidbody for the purposes of physics calculations. By default it is computed from all colliders belonging to the Rigidbody, but can be modified via script. More info
See in Glossary
Enable Automatic Center Of Mass to use the physics system’s predicted center of mass for the Rigidbody, based on its shape and scale. Disable to set your own X, Y and Z coordinates for the center of mass.
Automatic Tensor Enable Automatic Tensor to use the physics system’s predicted tensor and tensor rotation for the Rigidbody, based on all connected collidersAn invisible shape that is used to handle physical collisions for an object. A collider doesn’t need to be exactly the same shape as the object’s mesh - a rough approximation is often more efficient and indistinguishable in gameplay. More info
See in Glossary
. Like mass, an inertia tensor defines how much force or torque is required to make a Rigidbody move; however, while mass affects linear movement, inertia tensor affects rotational movement. Disable to set your own X, Y and Z coordinates for the tensor instead (see properties below).
- Inertia Tensor Define the inertia tensor of this Rigidbody. The higher the Inertia Tensor value is, the more torque is required to make the Rigidbody rotate on its axis.
- Inertia Tensor Rotation Define the rotation of the inertia tensor.
Use Gravity Toggle the effects of gravity on the Rigidbody. If enabled, the physics system applies a force to move the GameObject in the direction of simulated gravity (by default, down the y axis). Use Gravity is enabled by default.
Is Kinematic Toggle between physics-based and kinematic movement for the GameObject. When Is Kinematic is enabled, the physics system cannot apply forces to move or rotate the GameObject, instead, Unity can only move and rotate it via its Transform. See Introduction to Rigidbody physics: Rigidbody without physics-based movement for details. Is Kinematic is disabled by default.
Interpolate The Interpolate setting on a Rigidbody provides two options to smooth the appearance of a Rigidbody’s motion if it appears jittery at run time. These options are Interpolate and Extrapolate.

Both interpolation and extrapolation calculate the pose of the Rigidbody (that is, the position and rotation) between physics updates. Which one you should choose depends on which option produces the best visual outcome for your use case.

For detailed information on the Interpolate property, see Apply interpolation to a Rigidbody.
- None Apply no interpolation or extrapolation. This is the default option.
- Interpolate Use the pose and velocity of the Rigidbody from the previous two physics updates to calculate and apply the pose of the Rigidbody in the current frame.

Interpolate is more accurate than Extrapolate, but it has a time lag of one physics update. It’s usually best for situations where accuracy is important; for example, if the Rigidbody’s velocity varies, or if there are other physics elements that influence the Rigidbody’s movement.
- Extrapolate Use the pose and velocity of the Rigidbody from the previous physics update, and predict the pose of the Rigidbody in the next physics update, to calculate and predict the pose in the current frame.

Extrapolate makes the Rigidbody appear to move slightly ahead of where it should be, and can be slightly inaccurate. It’s usually best for situations where accuracy is not important; for example, if the Rigidbody moves at a constant velocity, and there are no other physics elements that influence the Rigidbody’s movement.
Collision Detection Define how the physics system detects collisions between this Rigidbody’s collider and other colliders in the scene. Unity generates one collision per pair of colliders, and determines the method of collision detection based on this Collision Detection property.

Collision Detection is set to Discrete by default. For more information on each collision detection type, see Continuous collision detectionA collision detection method that calculates and resolves collisions over the entire physics simulation step. This can prevent fast-moving objects from tunnelling through walls during a simulation step. More info
See in Glossary
.
- Discrete The physics system uses discrete collisionA collision occurs when the physics engine detects that the colliders of two GameObjects make contact or overlap, when at least one has a Rigidbody component and is in motion. More info
See in Glossary
detection to calculate collisions for this Rigidbody’s collider. Select Discrete if this Rigidbody is not involved in any fast-moving collisions. Discrete collision detectionAn automatic process performed by Unity which determines whether a moving GameObject with a Rigidbody and collider component has come into contact with any other colliders. More info
See in Glossary
is not very computationally intensive.
- Continuous The physics system uses sweep-based CCD to calculate collisions between this Rigidbody’s collider and any static colliders (that is, colliders without an associated Rigidbody). Select Continuous if this Rigidbody is involved in fast-moving collisions with static colliders. Sweep-based CCD is more computationally intensive than Discrete or Continuous Speculative.
- Continuous Dynamic The physics system uses sweep-based CCD to calculate collisions between this Rigidbody’s collider and all other colliders, except for those that are set to Discrete collision detection. Select Continuous Dynamic if this Rigidbody is involved in fast-moving collisions with any colliders. Sweep-based CCD is more computationally intensive than Discrete or Continuous Speculative.
- Continuous Speculative The physics system uses speculative continuous collision detectionA collision detection method that inflates broad-phase AABB of moving objects according to their velocities. This enables support for effects like rotations. More info
See in Glossary
to calculate collisions between this Rigidbody’s collider and all other colliders. Select Continuous Speculative if collision accuracy is not important for this Rigidbody. Speculative collision detection is more computationally intensive than Discrete, but less computationally intensive than Continuous or Continuous Dynamic.
Constraints Place restrictions on the Rigidbody’s movement.
- Freeze Position Stops the Rigidbody moving in the world X, Y and Z axes selectively.
- Freeze Rotation Stops the Rigidbody rotating around the local X, Y and Z axes selectively.

Rigidbody

Apply interpolation to a Rigidbody
Constant Force component reference
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961