/** * <code>removeFromParent</code> removes this Spatial from its parent. * * @return true if it has a parent and performed the remove. */ public boolean removeFromParent() { if (parent != null) { parent.detachChild(this); return true; } return false; }
@Override public void cleanup() { super.cleanup(); guiNode.detachChild(statsView); guiNode.detachChild(fpsText); guiNode.detachChild(darkenFps); guiNode.detachChild(darkenStats); }
public void onAnalog(String binding, float value, float tpf) { if (binding.equals("START") && !START){ START = true; guiNode.detachChild(pressStart); System.out.println("START"); }else if (START == true && binding.equals("Left")){ player.move(0, 0, -(speed / 2f) * value * fpsRate); camAngle -= value*tpf; }else if (START == true && binding.equals("Right")){ player.move(0, 0, (speed / 2f) * value * fpsRate); camAngle += value*tpf; } }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geomA); node.attachChild(geomB); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geomA); node.detachChild(geomB); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geomA); node.attachChild(geomB); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geomA); node.detachChild(geomB); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geom); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geom); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geom); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geom); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geom); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geom); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geom); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geom); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(suspensionNode); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(suspensionNode); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geom); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geom); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(geom); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(geom); } super.setSpatial(spatial); }
/** * 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) */ @Override public void setSpatial(Spatial spatial) { if (spatial != null && spatial instanceof Node) { Node node = (Node) spatial; node.attachChild(suspensionNode); } else if (spatial == null && this.spatial != null) { Node node = (Node) this.spatial; node.detachChild(suspensionNode); } super.setSpatial(spatial); }
@Override public void cleanup() { super.cleanup(); //detach everything when we are detached application.getRootNode().detachChild(rootNode); application.getStateManager().detach(physicsState); cleanupData(); }
/** * The mesh builds geometries from the mesh. The result is stored in the blender context * under the mesh's OMA. */ public void toGeometries() { LOGGER.log(Level.FINE, "Converting temporal mesh {0} to jme geometries.", name); List<Geometry> result = new ArrayList<Geometry>(); MeshHelper meshHelper = blenderContext.getHelper(MeshHelper.class); Node parent = this.getParent(); parent.detachChild(this); this.prepareFacesGeometry(result, meshHelper); this.prepareLinesGeometry(result, meshHelper); this.preparePointsGeometry(result, meshHelper); blenderContext.addLoadedFeatures(meshStructure.getOldMemoryAddress(), LoadedDataType.FEATURE, result); for (Geometry geometry : result) { parent.attachChild(geometry); } for (Modifier modifier : postMeshCreationModifiers) { modifier.postMeshCreationApply(parent, blenderContext); } }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_PINK); body.getPhysicsLocation(location); applyPhysicsTransform(location, Quaternion.IDENTITY); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_PINK); body.getPhysicsLocation(location); applyPhysicsTransform(location, Quaternion.IDENTITY); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_YELLOW); body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } geom.setMaterial(debugAppState.DEBUG_YELLOW); body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }
/** * Update this control. Invoked once per frame during the logical-state * update, provided the control is enabled and added to a scene. Should be * invoked only by a subclass or by AbstractControl. * * @param tpf the time interval between frames (in seconds, ≥0) */ @Override protected void controlUpdate(float tpf) { CollisionShape newShape = body.getCollisionShape(); Vector3f newScale = newShape.getScale(); if (myShape != newShape || !oldScale.equals(newScale)) { myShape = newShape; oldScale.set(newScale); Node node = (Node) spatial; node.detachChild(geom); geom = DebugShapeFactory.getDebugShape(myShape); geom.setName(body.toString()); node.attachChild(geom); } if(body.isActive()){ geom.setMaterial(debugAppState.DEBUG_MAGENTA); }else{ geom.setMaterial(debugAppState.DEBUG_BLUE); } body.getPhysicsLocation(location); body.getPhysicsRotation(rotation); applyPhysicsTransform(location, rotation); }