@Override public void dispose() { // Don't rely on the GC if (bodyInfo != null) bodyInfo.delete(); if (shape != null) shape.delete(); // Remove references so the GC can do it's work bodyInfo = null; shape = null; }
private void create(final Mesh mesh, final float mass, final btCollisionShape shape) { this.mesh = mesh; this.shape = shape; // Calculate the local inertia, bodies with no mass are static Vector3 localInertia; if (mass == 0) localInertia = Vector3.Zero; else { shape.calculateLocalInertia(mass, Vector3.tmp); localInertia = Vector3.tmp; } // 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); }