applyLocalForce method

void applyLocalForce(
  1. Vec3 localForce,
  2. Vec3 localPoint
)

Apply force 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 applyLocalForce(Vec3 localForce, Vec3 localPoint){
  if (type != BodyTypes.dynamic) {
    return;
  }

  final worldForce = _bodyApplyLocalWorldForce;
  final relativePointWorld = _bodyApplyLocalForceRelativePointWorld;

  // Transform the force vector to world space
  vectorToWorldFrame(localForce, worldForce);
  vectorToWorldFrame(localPoint, relativePointWorld);

  applyForce(worldForce, relativePointWorld);
}