void ApplyTorque( Vector3& force )

book_4_sparkGenerated
code_blocksInput

Description

The ApplyTorque method applies angular velocity to the Rigidbody component. This method is used to simulate rotational forces on the object, causing it to spin or rotate around its center of mass.

Usage

To use the ApplyTorque method, you need to have a Rigidbody component attached to your game object. You can then call this method and pass a Vector3 reference that represents the torque to be applied. The torque vector determines the axis and magnitude of the rotation.

Example

// Example of applying torque to a Rigidbody
Rigidbody myRigidbody = new Rigidbody();
Vector3 torque = new Vector3(0, 10, 0); // Apply torque around the Y-axis
myRigidbody.ApplyTorque(ref torque);