ConstantForce
A force applied constantly.
Read time 6 minutesLast updated 3 days ago
Definition
- Type: Class
- Namespace: UnityEngine
- Assembly: UnityEngine.PhysicsModule
- Inherits from: Behaviour
[RequireComponent(typeof(Rigidbody))]public class ConstantForce : Behaviour
Remarks
This is a small physics utility class used to apply a continous force to an object.
Rigidbody.AddForce applies a force to the Rigidbody only for one frame, thus you have to keep calling the function. ConstantForce on the other hand will apply the force every frame until you change the force or torque to a new value.
Additional Resources: Rigidbody
Properties
Property | Description |
|---|---|
| force | The force applied to the rigidbody every frame. |
| relativeForce | The force - relative to the rigid bodies coordinate system - applied every frame. |
| relativeTorque | The torque - relative to the rigid bodies coordinate system - applied every frame. |
| torque | The torque applied to the rigidbody every frame. |
Inheritance
Operators
Operator | Description |
|---|---|
| operator == | Compares two object references to see if they refer to the same object. |
| bool | Determines whether the object exists. |
| operator != | Compares if two objects refer to a different object. |