void ApplyImpulseAt( Vector3& position, Vector3& force )

book_4_sparkGenerated
code_blocksInput

Description

The ApplyImpulseAt method applies an instant linear impulse to the Rigidbody at a specified position. This is typically used to simulate effects such as a bullet impact, where an immediate change in velocity is required at a specific point on the object.

Usage

To use the ApplyImpulseAt method, you need to provide two parameters:

  • position: A reference to a Vector3 that specifies the position on the Rigidbody where the impulse should be applied.
  • force: A reference to a Vector3 that represents the magnitude and direction of the impulse to be applied.

This method does not return a value.

Example

// Example of using ApplyImpulseAt
Rigidbody rigidbody = new Rigidbody();
Vector3 impactPosition = new Vector3(1.0f, 0.0f, 0.0f);
Vector3 impulseForce = new Vector3(10.0f, 0.0f, 0.0f);

// Apply an impulse at the specified position
rigidbody.ApplyImpulseAt(ref impactPosition, ref impulseForce);