@Override public void simpleUpdate(float tpf) { timer += tpf; float xOffset = FastMath.sin(timer * 0.5f) * 2f; leftQuad.setLocalTranslation(xOffset - 2f, 0f, 0.5f); rightQuad.setLocalTranslation(xOffset + 1f, 0f, 0.5f); }
/** * Alter the location and extent of the blue arrow. * * @param location the coordinates of the tail (not null, unaffected) * @param extent the offset of the tip from the tail (not null, unaffected) */ public void setBlueArrow(Vector3f location, Vector3f extent) { arrowBlueGeom.setLocalTranslation(location); arrowBlue.setArrowExtent(extent); }
/** * Alter the location and extent of the green arrow. * * @param location the coordinates of the tail (not null, unaffected) * @param extent the offset of the tip from the tail (not null, unaffected) */ public void setGreenArrow(Vector3f location, Vector3f extent) { arrowGreenGeom.setLocalTranslation(location); arrowGreen.setArrowExtent(extent); }
/** * Alter the location and extent of the red arrow. * * @param location the coordinates of the tail (not null, unaffected) * @param extent the offset of the tip from the tail (not null, unaffected) */ public void setRedArrow(Vector3f location, Vector3f extent) { arrowRedGeom.setLocalTranslation(location); arrowRed.setArrowExtent(extent); }
/** * Alter the location and extent of the red arrow. * * @param location the coordinates of the tail (not null, unaffected) * @param extent the offset of the tip from the tail (not null, unaffected) */ public void setRedArrow(Vector3f location, Vector3f extent) { arrowRedGeom.setLocalTranslation(location); arrowRed.setArrowExtent(extent); }
/** * Alter the location and extent of the magenta arrow. * * @param location the coordinates of the tail (not null, unaffected) * @param extent the offset of the tip from the tail (not null, unaffected) */ public void setMagentaArrow(Vector3f location, Vector3f extent) { arrowMagentaGeom.setLocalTranslation(location); arrowMagenta.setArrowExtent(extent); }
/** * Alter the location and extent of the pink arrow. * * @param location the coordinates of the tail (not null, unaffected) * @param extent the offset of the tip from the tail (not null, unaffected) */ public void setPinkArrow(Vector3f location, Vector3f extent) { arrowPinkGeom.setLocalTranslation(location); arrowPink.setArrowExtent(extent); }
@Override public void simpleUpdate(float tpf) { fpsText.setText("Light Position: "+lightPos.toString()+" Change Light position with [U], [H], [J], [K] and [T], [G] Turn off water with [O]"); lightSphere.setLocalTranslation(lightPos); waterProcessor.setLightPosition(lightPos); }
private Geometry createInstance(float x, float z) { Mesh mesh; if (FastMath.nextRandomInt(0, 1) == 1) mesh = mesh2; else mesh = mesh1; Geometry geometry = new Geometry("randomGeom", mesh); geometry.setMaterial(materials[FastMath.nextRandomInt(0, materials.length - 1)]); geometry.setLocalTranslation(x, 0, z); return geometry; }
@Override public void simpleUpdate(float tpf){ angle += tpf; angle %= FastMath.TWO_PI; pl.setPosition(new Vector3f(FastMath.cos(angle) * 3f, 0.5f, FastMath.sin(angle) * 3f)); lightMdl.setLocalTranslation(pl.getPosition()); }
/** A cube object for target practice */ protected Geometry makeCube(String name, float x, float y, float z) { Box box = new Box(1, 1, 1); Geometry cube = new Geometry(name, box); cube.setLocalTranslation(x, y, z); Material mat1 = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat1.setColor("Color", ColorRGBA.randomColor()); cube.setMaterial(mat1); return cube; }
private Geometry createFirstCube() { Vector3f loc = player.getLocalTranslation(); loc.addLocal(4, 0, 0); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); geom.setLocalTranslation(loc); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setColor("Color", ColorRGBA.Blue); geom.setMaterial(mat); return geom; }
/** Make a solid floor and add it to the scene. */ public void initFloor() { Geometry floor_geo = new Geometry("Floor", floor); floor_geo.setMaterial(floor_mat); floor_geo.setLocalTranslation(0, -0.1f, 0); this.rootNode.attachChild(floor_geo); /* Make the floor physical with mass 0.0f! */ floor_phy = new RigidBodyControl(0.0f); floor_geo.addControl(floor_phy); bulletAppState.getPhysicsSpace().add(floor_phy); }
public void addBrick(Vector3f ori) { Geometry reBoxg = new Geometry("brick", brick); reBoxg.setMaterial(mat); reBoxg.setLocalTranslation(ori); reBoxg.rotate(0f, (float)Math.toRadians(angle) , 0f ); reBoxg.addControl(new RigidBodyControl(1.5f)); reBoxg.setShadowMode(ShadowMode.CastAndReceive); reBoxg.getControl(RigidBodyControl.class).setFriction(1.6f); this.batchNode.attachChild(reBoxg); this.getPhysicsSpace().add(reBoxg); nbBrick++; }
public void addBrick(Vector3f ori) { Geometry reBoxg = new Geometry("brick", brick); reBoxg.setMaterial(mat); reBoxg.setLocalTranslation(ori); reBoxg.rotate(0f, (float)Math.toRadians(angle) , 0f ); reBoxg.addControl(new RigidBodyControl(1.5f)); reBoxg.setShadowMode(ShadowMode.CastAndReceive); reBoxg.getControl(RigidBodyControl.class).setFriction(1.6f); this.rootNode.attachChild(reBoxg); this.getPhysicsSpace().add(reBoxg); }
private void addBrick(Vector3f ori) { Geometry reBoxg = new Geometry("brick", brick); reBoxg.setMaterial(matBullet); reBoxg.setLocalTranslation(ori); reBoxg.addControl(new RigidBodyControl(1.5f)); reBoxg.setShadowMode(ShadowMode.CastAndReceive); this.rootNode.attachChild(reBoxg); this.getPhysicsSpace().add(reBoxg); }
@Override public void simpleUpdate(float tpf) { super.simpleUpdate(tpf); angle += tpf; angle %= FastMath.TWO_PI; spot.setPosition(new Vector3f(FastMath.cos(angle) * 30f, 34.013165f, FastMath.sin(angle) * 30f)); lightMdl.setLocalTranslation(spot.getPosition()); spot.setDirection(lightTarget.subtract(spot.getPosition())); }
@Override public void simpleUpdate(float tpf) { if (!stop) { super.simpleUpdate(tpf); angle += tpf; angle %= FastMath.TWO_PI; spot.setPosition(new Vector3f(FastMath.cos(angle) * 30f, 34.013165f, FastMath.sin(angle) * 30f)); lightMdl.setLocalTranslation(spot.getPosition()); spot.setDirection(lightTarget.subtract(spot.getPosition())); } } }
public void addBrick(Vector3f ori) { Geometry reBoxg = new Geometry("brick", brick); reBoxg.setMaterial(mat); reBoxg.setLocalTranslation(ori); //for geometry with sphere mesh the physics system automatically uses a sphere collision shape reBoxg.addControl(new RigidBodyControl(1.5f)); reBoxg.setShadowMode(ShadowMode.CastAndReceive); reBoxg.getControl(RigidBodyControl.class).setFriction(0.6f); this.rootNode.attachChild(reBoxg); this.getPhysicsSpace().add(reBoxg); }
private void setupPlanet() { Material material = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); material.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); //immovable sphere with mesh collision shape Sphere sphere = new Sphere(64, 64, 20); planet = new Geometry("Sphere", sphere); planet.setMaterial(material); planet.setLocalTranslation(30, -15, 30); planet.addControl(new RigidBodyControl(new MeshCollisionShape(sphere), 0)); rootNode.attachChild(planet); getPhysicsSpace().add(planet); }