/** * If enabled, add this control's physics object to the specified physics * space. If not enabled, alter where the object would be added. The object * is removed from any other space it's in. * * @param newSpace where to add, or null to simply remove */ @Override public void setPhysicsSpace(PhysicsSpace newSpace) { if (space == newSpace) { return; } if (added) { removePhysics(space); added = false; } if (newSpace != null && isEnabled()) { addPhysics(newSpace); added = true; } /* * If this control isn't enabled, its physics object will be * added to the new space when the control becomes enabled. */ space = newSpace; }
/** * If enabled, add this control's physics object to the specified physics * space. If not enabled, alter where the object would be added. The object * is removed from any other space it's in. * * @param newSpace where to add, or null to simply remove */ @Override public void setPhysicsSpace(PhysicsSpace newSpace) { if (space == newSpace) { return; } if (added) { removePhysics(space); added = false; } if (newSpace != null && isEnabled()) { addPhysics(newSpace); added = true; } /* * If this control isn't enabled, its physics object will be * added to the new space when the control becomes enabled. */ space = newSpace; }
public static void printControls(Spatial spatial) { System.out.println("Controls of "+spatial.getName()); for (int i = 0; i < spatial.getNumControls(); i++) { Control c = spatial.getControl(i); System.out.print("\t-" + c.getClass().getSimpleName()); if (c instanceof AbstractControl) { System.out.println(" " + ((AbstractControl) c).isEnabled()); } else if (c instanceof AbstractPhysicsControl) { System.out.println(" " + ((AbstractPhysicsControl) c).isEnabled()); } else { System.out.println(""); } } System.out.println(""); }
/** * If enabled, add this control's physics object to the specified physics * space. If not enabled, alter where the object would be added. The object * is removed from any other space it's in. * * @param newSpace where to add, or null to simply remove */ @Override public void setPhysicsSpace(PhysicsSpace newSpace) { if (space == newSpace) { return; } if (added) { removePhysics(space); added = false; } if (newSpace != null && isEnabled()) { addPhysics(newSpace); added = true; } /* * If this control isn't enabled, its physics object will be * added to the new space when the control becomes enabled. */ space = newSpace; }