void ClearForces()

robot_2Generated
code_blocksInput

Description

Clears all accumulated linear forces that have been applied to the PhysicsBody during the current physics frame but have not yet been processed. This includes forces applied using the ApplyForce and ApplyForceAt methods.

Usage

Use this method when you want to reset the forces acting on a PhysicsBody before the physics simulation processes them. This can be useful in scenarios where you need to cancel out any forces that have been applied during the frame, such as when resetting an object's state or preparing it for a new set of force applications.

Example

// Example of using ClearForces
PhysicsBody myPhysicsBody = new PhysicsBody();

// Apply some forces
myPhysicsBody.ApplyForce(new Vector3(10, 0, 0));
myPhysicsBody.ApplyForceAt(new Vector3(0, 0, 0), new Vector3(0, 10, 0));

// Clear all forces before they are applied
myPhysicsBody.ClearForces();

// Now the physics body will not be affected by the previously applied forces in this frame.