applyLocalImpulse method

void applyLocalImpulse(
  1. Vec3 localImpulse,
  2. Vec3 localPoint
)

Apply locally-defined impulse to a local point in the body. @param force The force vector to apply, defined locally in the body frame. @param localPoint A local point in the body to apply the force on.

Implementation

void applyLocalImpulse(Vec3 localImpulse, Vec3 localPoint){
  if (type != BodyTypes.dynamic) {
    return;
  }

  final worldImpulse = _bodyApplyLocalImpulseWorldImpulse;
  final relativePointWorld = _bodyApplyLocalImpulseRelativePoint;

  // Transform the force vector to world space
  vectorToWorldFrame(localImpulse, worldImpulse);
  vectorToWorldFrame(localPoint, relativePointWorld);

  applyImpulse(worldImpulse, relativePointWorld);
}