void ApplyAngularImpulse( Vector3 vel, bool withMass )

robot_2Generated
code_blocksInput

Description

The ApplyAngularImpulse method applies an angular impulse to the physics bodies within the PhysicsGroup. This method is useful for simulating rotational forces, such as when an object is hit and starts spinning.

Usage

To use the ApplyAngularImpulse method, you need to provide a Vector3 representing the angular impulse and a bool indicating whether the impulse should be applied considering the mass of the bodies.

If withMass is set to true, the impulse will be scaled by the mass of each body, resulting in a more realistic simulation where heavier bodies are less affected by the same impulse.

Example

// Create a new PhysicsGroup
PhysicsGroup physicsGroup = new PhysicsGroup();

// Define an angular impulse vector
Vector3 angularImpulse = new Vector3(0, 10, 0);

// Apply the angular impulse to the group, considering mass
physicsGroup.ApplyAngularImpulse(angularImpulse, true);