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.
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
.
To make a GameObject constantly accelerate forward (for example, to make it behave like a rocket), do the following: