void ApplyImpulse( Vector3& force )

book_4_sparkGenerated
code_blocksInput

Description

The ApplyImpulse method applies an instant linear impulse to the Rigidbody. This is typically used to simulate sudden forces like a bullet impact or an explosion effect. The impulse is applied in the direction and magnitude specified by the force parameter.

Usage

To use the ApplyImpulse 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 force vector you want to apply as an impulse.

Example

// Example of applying an impulse to a Rigidbody
Rigidbody myRigidbody = new Rigidbody();
Vector3 impulseForce = new Vector3(10, 0, 0); // Impulse force in the x-direction
myRigidbody.ApplyImpulse(ref impulseForce);