void ClearForces()

book_4_sparkGenerated
code_blocksInput

Description

The ClearForces method is used to clear any accumulated linear forces that have been applied to a PhysicsBody during the current physics frame but have not yet been applied to the body. This is useful for resetting the forces on a physics body, ensuring that any forces applied in the current frame are not carried over to the next frame.

Usage

Call this method on a PhysicsBody instance when you want to reset the linear forces that have been accumulated but not yet applied. This is typically done at the end of a physics update cycle to ensure that forces are not unintentionally applied in subsequent frames.

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 the forces before the next physics update
myPhysicsBody.ClearForces();