Esempio n. 1
0
  @Override
  public void dispose() {
    groundObject.dispose();
    groundShape.dispose();

    ballObject.dispose();
    ballShape.dispose();

    dispatcher.dispose();
    collisionConfig.dispose();

    modelBatch.dispose();
    model.dispose();
  }
Esempio n. 2
0
 @Override
 public void dispose() {
   if (motionState != null) motionState.release();
   motionState = null;
   if (collisionShape != null) collisionShape.release();
   collisionShape = null;
   super.dispose();
 }
Esempio n. 3
0
 @Override
 public void dispose() {
   // Don't rely on the GC
   if (bodyInfo != null) bodyInfo.dispose();
   if (shape != null) shape.dispose();
   // Remove references so the GC can do it's work
   bodyInfo = null;
   shape = null;
 }
Esempio n. 4
0
  private void create(final Model model, final float mass, final btCollisionShape shape) {
    this.model = model;
    this.shape = shape;

    if (shape != null && mass >= 0) {
      // Calculate the local inertia, bodies with no mass are static
      Vector3 localInertia;
      if (mass == 0) localInertia = Vector3.Zero;
      else {
        shape.calculateLocalInertia(mass, tmpV);
        localInertia = tmpV;
      }

      // For now just pass null as the motionstate, we'll add that to the body in the entity itself
      bodyInfo = new btRigidBodyConstructionInfo(mass, null, shape, localInertia);
    }
  }
Esempio n. 5
0
 protected void refCollisionShape(btCollisionShape shape) {
   if (collisionShape == shape) return;
   if (collisionShape != null) collisionShape.release();
   collisionShape = shape;
   if (collisionShape != null) collisionShape.obtain();
 }