To apply a constant linear or rotational force to a GameObject’s Rigidbody, add the Constant Force 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: