/** Builds/rebuilds the phyiscs body when parameters have changed */
 protected void rebuildRigidBody() {
   boolean removed = false;
   if (collisionShape instanceof MeshCollisionShape && mass != 0) {
     throw new IllegalStateException("Dynamic rigidbody can not have mesh collision shape!");
   }
   if (objectId != 0) {
     if (isInWorld(objectId)) {
       PhysicsSpace.getPhysicsSpace().remove(this);
       removed = true;
     }
     Logger.getLogger(this.getClass().getName())
         .log(Level.FINE, "Clearing RigidBody {0}", Long.toHexString(objectId));
     finalizeNative(objectId);
   }
   preRebuild();
   objectId = createRigidBody(mass, motionState.getObjectId(), collisionShape.getObjectId());
   Logger.getLogger(this.getClass().getName())
       .log(Level.FINE, "Created RigidBody {0}", Long.toHexString(objectId));
   postRebuild();
   if (removed) {
     PhysicsSpace.getPhysicsSpace().add(this);
   }
 }