Version: 2023.2
Language : English
Configure Rigidbody Colliders
Apply interpolation to a Rigidbody

Apply constant force to a Rigidbody

To apply a constant linear or rotational force to a 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
’s RigidbodyA component that allows a GameObject to be affected by simulated gravity and other forces. More info
See in Glossary
, add the Constant ForceA simple component for adding a constant force or torque to game objects with a Rigidbody. More info
See in Glossary
component (represented by the API class ConstantForce) to your GameObject. See Constant Force component reference for details on how to configure the properties on the component.

Set maximum velocity limitations

Constant force is not the same as constant speed. When you apply a constant force, the speed of movement accelerates over time based on the value of the force. In real life, this acceleration continues indefinitely. By default in Unity’s physics simulation, linear acceleration continues indefinitely, and angular acceleration continues until the Rigidbody reaches a max velocity of 50 rad/s. You can change these maximum velocities in code, via the properties Rigidbody.maxLinearVelocity and Rigidbody.maxAngularVelocity.

Configure constant forward acceleration

To make a GameObject constantly accelerate forward (for example, to make it behave like a rocket), do the following:

  1. Add a Constant Force component to the GameObject.
  2. On the Constant Force component, set the Relative Force Z axis to a positive value.
  3. On the Rigidbody, disable Use Gravity. This ensures that there is no competing gravitational force acting upon the GameObject.
  4. On the Rigidbody component, set the Drag property so that the Rigidbody does not exceed your preferred maximum velocity (the higher the drag, the lower the maximum velocity will be). This might require some trial and error to get the effect you want.
Configure Rigidbody Colliders
Apply interpolation to a Rigidbody
Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961