void ApplyForce( Vector3 force )

book_4_sparkGenerated
code_blocksInput

Description

The ApplyForce method applies a continuous force to the PhysicsBody in the direction specified by the force parameter. This method is useful for simulating effects such as wind or propulsion, where a constant force is applied over time.

Usage

To use the ApplyForce method, you need to have an instance of PhysicsBody. Call the method with a Vector3 representing the direction and magnitude of the force you wish to apply. The force will be applied continuously until it is cleared or the simulation ends.

Example

// Example of applying a force to a PhysicsBody
PhysicsBody myPhysicsBody = new PhysicsBody();
Vector3 forceDirection = new Vector3(0, 0, 10); // Force applied upwards
myPhysicsBody.ApplyForce(forceDirection);