/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is added to a scene. Do not invoke directly * from user code. * * @param tpf the time interval between frames (in seconds, ≥0) */ public void update(float tpf) { if (!enabled) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is added to a scene. Do not invoke directly * from user code. * * @param tpf the time interval between frames (in seconds, ≥0) */ public void update(float tpf) { if (!enabled) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Alter which spatial is controlled. Invoked when the control is added to * or removed from a spatial. Should be invoked only by a subclass or from * Spatial. Do not invoke directly from user code. * * @param spatial the spatial to control (or null) */ public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Alter which spatial is controlled. Invoked when the control is added to * or removed from a spatial. Should be invoked only by a subclass or from * Spatial. Do not invoke directly from user code. * * @param spatial the spatial to control (or null) */ public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Enable or disable this control. * <p> * When the control is disabled, the ghost object is removed from physics * space. When the control is enabled again, the object is moved to the * current location of the spatial and then added to the physics space. * * @param enabled true→enable the control, false→disable it */ public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if (spatial != null) { setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
/** * Enable or disable this control. * <p> * When the control is disabled, the ghost object is removed from physics * space. When the control is enabled again, the object is moved to the * current location of the spatial and then added to the physics space. * * @param enabled true→enable the control, false→disable it */ public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if (spatial != null) { setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
public void update(float tpf) { if (!enabled) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
public void update(float tpf) { if (!enabled) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is added to a scene. Do not invoke directly * from user code. * * @param tpf the time interval between frames (in seconds, ≥0) */ public void update(float tpf) { if (!enabled) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
/** * Alter which spatial is controlled. Invoked when the control is added to * or removed from a spatial. Should be invoked only by a subclass or from * Spatial. Do not invoke directly from user code. * * @param spatial the spatial to control (or null) */ public void setSpatial(Spatial spatial) { this.spatial = spatial; setUserObject(spatial); if (spatial == null) { return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }
public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if (spatial != null) { setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if (spatial != null) { setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
/** * Enable or disable this control. * <p> * When the control is disabled, the ghost object is removed from physics * space. When the control is enabled again, the object is moved to the * current location of the spatial and then added to the physics space. * * @param enabled true→enable the control, false→disable it */ public void setEnabled(boolean enabled) { this.enabled = enabled; if (space != null) { if (enabled && !added) { if (spatial != null) { setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); } space.addCollisionObject(this); added = true; } else if (!enabled && added) { space.removeCollisionObject(this); added = false; } } }
public void setSpatial(Spatial spatial) { if (getUserObject() == null || getUserObject() == this.spatial) { setUserObject(spatial); } this.spatial = spatial; if (spatial == null) { if (getUserObject() == spatial) { setUserObject(null); } return; } setPhysicsLocation(getSpatialTranslation()); setPhysicsRotation(getSpatialRotation()); }