applyForce method

void applyForce (Vector2 force, Vector2 point)

Apply a force at a world point. If the force is not applied at the center of mass, it will generate a torque and affect the angular velocity. This wakes up the body.

@param force the world force vector, usually in Newtons (N). @param point the world position of the point of application.

Implementation

void applyForce(Vector2 force, Vector2 point) {
  if (_bodyType != BodyType.DYNAMIC) {
    return;
  }

  if (isAwake() == false) {
    setAwake(true);
  }

  // _force.addLocal(force);
  // Vec2 temp = tltemp.get();
  // temp.set(point).subLocal(_sweep.c);
  // _torque += Vec2.cross(temp, force);

  _force.x += force.x;
  _force.y += force.y;

  _torque +=
      (point.x - _sweep.c.x) * force.y - (point.y - _sweep.c.y) * force.x;
}