applyLinearImpulse method

void applyLinearImpulse(
  1. Vector2 impulse, {
  2. Vector2? point,
  3. bool wake = true,
})

Applies impulse at world point, or at the center of mass when point is omitted, immediately changing the linear velocity.

Implementation

void applyLinearImpulse(Vector2 impulse, {Vector2? point, bool wake = true}) {
  if (point == null) {
    rawBox2D.bodyApplyLinearImpulseToCenter(
      index1,
      worldAndGeneration,
      impulse.x,
      impulse.y,
      wake: wake,
    );
  } else {
    rawBox2D.bodyApplyLinearImpulse(
      index1,
      worldAndGeneration,
      impulse.x,
      impulse.y,
      point.x,
      point.y,
      wake: wake,
    );
  }
}