public void addRigidBody(RigidBody body, short group, short mask) {
    if (!body.isStaticOrKinematicObject()) {
      body.setGravity(gravity);
    }

    if (body.getCollisionShape() != null) {
      addCollisionObject(body, group, mask);
    }
  }
 @Override
 public void setGravity(Vector3f gravity) {
   this.gravity.set(gravity);
   for (int i = 0; i < collisionObjects.size(); i++) {
     CollisionObject colObj = collisionObjects.getQuick(i);
     RigidBody body = RigidBody.upcast(colObj);
     if (body != null) {
       body.setGravity(gravity);
     }
   }
 }
  @Override
  public void addRigidBody(RigidBody body) {
    if (!body.isStaticOrKinematicObject()) {
      body.setGravity(gravity);
    }

    if (body.getCollisionShape() != null) {
      boolean isDynamic = !(body.isStaticObject() || body.isKinematicObject());
      short collisionFilterGroup =
          isDynamic
              ? (short) CollisionFilterGroups.DEFAULT_FILTER
              : (short) CollisionFilterGroups.STATIC_FILTER;
      short collisionFilterMask =
          isDynamic
              ? (short) CollisionFilterGroups.ALL_FILTER
              : (short) (CollisionFilterGroups.ALL_FILTER ^ CollisionFilterGroups.STATIC_FILTER);

      addCollisionObject(body, collisionFilterGroup, collisionFilterMask);
    }
  }