@Override public void simpleUpdate(float tpf){ Quaternion q = new Quaternion(); angle += tpf; angle %= FastMath.TWO_PI; q.fromAngles(angle, 0, angle); offBox.setLocalRotation(q); offBox.updateLogicalState(tpf); offBox.updateGeometricState(); }
@Override public void simpleUpdate(float tpf){ Quaternion q = new Quaternion(); angle += tpf; angle %= FastMath.TWO_PI; q.fromAngles(angle, 0, angle); offBox.setLocalRotation(q); offBox.updateLogicalState(tpf); offBox.updateGeometricState(); } }
private void attachRandomGeometry(Node node, Material mat) { Box box = new Box(0.25f, 0.25f, 0.25f); Torus torus = new Torus(16, 16, 0.2f, 0.8f); Geometry[] boxes = new Geometry[]{ new Geometry("box1", box), new Geometry("box2", box), new Geometry("box3", box), new Geometry("torus1", torus), new Geometry("torus2", torus), new Geometry("torus3", torus) }; for (int i = 0; i < boxes.length; i++) { Geometry geometry = boxes[i]; geometry.setLocalTranslation((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10); geometry.setLocalRotation(new Quaternion().fromAngles((float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI, (float) Math.random() * FastMath.PI)); geometry.setLocalScale((float) Math.random() * 10 -10, (float) Math.random() * 10 -10, (float) Math.random() * 10 -10); geometry.setMaterial(mat); node.attachChild(geometry); } }
@Override public void simpleUpdate(float tpf){ Quaternion q = new Quaternion(); if (offView.isEnabled()) { angle += tpf; angle %= FastMath.TWO_PI; q.fromAngles(angle, 0, angle); offBox.setLocalRotation(q); offBox.updateLogicalState(tpf); offBox.updateGeometricState(); } }
/** * Creates a quad with the water material applied to it. * @param width * @param height * @return */ public Geometry createWaterGeometry(float width, float height) { Quad quad = new Quad(width, height); Geometry geom = new Geometry("WaterGeometry", quad); geom.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); geom.setMaterial(material); return geom; }
geometry.setLocalRotation(tempRot);
geometry.setLocalRotation(tempRot);
@Override public void simpleUpdate(float tpf) { if (!done) { done = true; batch.attachChild(cube2); batch.batch(); } updateBoindPoints(points); frustum.update(points); time += tpf; dl.setDirection(cam.getDirection()); cube2.setLocalTranslation(FastMath.sin(-time) * 3, FastMath.cos(time) * 3, 0); cube2.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Z)); cube2.setLocalScale(Math.max(FastMath.sin(time), 0.5f)); // batch.setLocalRotation(new Quaternion().fromAngleAxis(time, Vector3f.UNIT_Z)); } //
public void setupFloor() { mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWall.j3m"); Node floorGeom = new Node("floorGeom"); Quad q = new Quad(100, 100); q.scaleTextureCoordinates(new Vector2f(10, 10)); Geometry g = new Geometry("geom", q); g.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); floorGeom.attachChild(g); TangentBinormalGenerator.generate(floorGeom); floorGeom.setLocalTranslation(-50, 22, 60); //floorGeom.setLocalScale(100); floorGeom.setMaterial(mat); rootNode.attachChild(floorGeom); }
public void setupFloor() { mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWallPBR.j3m"); //mat = assetManager.loadMaterial("Textures/Terrain/BrickWall/BrickWallPBR2.j3m"); Node floorGeom = new Node("floorGeom"); Quad q = new Quad(100, 100); q.scaleTextureCoordinates(new Vector2f(10, 10)); Geometry g = new Geometry("geom", q); g.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); floorGeom.attachChild(g); TangentBinormalGenerator.generate(floorGeom); floorGeom.setLocalTranslation(-50, 22, 60); //floorGeom.setLocalScale(100); floorGeom.setMaterial(mat); rootNode.attachChild(floorGeom); }
mat_ground.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); Geometry ground = new Geometry("ground", new Quad(50, 50)); ground.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); ground.setLocalTranslation(-25, -1, 25); ground.setMaterial(mat_ground);
mat_ground.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); Geometry ground = new Geometry("ground", new Quad(50, 50)); ground.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); ground.setLocalTranslation(-25, -1, 25); ground.setMaterial(mat_ground);
mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); Geometry ground = new Geometry("ground", new Quad(50, 50)); ground.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); ground.setLocalTranslation(-25, -1, 25); ground.setMaterial(mat);
water.setLocalRotation(new Quaternion().fromAngleAxis(-FastMath.HALF_PI, Vector3f.UNIT_X)); water.setMaterial(waterProcessor.getMaterial()); water.setLocalTranslation(-200, -20, 250);
groundBoxWhite.setLocalRotation(new Quaternion(f)); groundBoxWhite.move(7.5f, -.75f, 7.5f); final Material groundMaterial = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
public void setDirection_onRendThrd(Quaternion dirQuat) { myDirection = dirQuat; if (myGeom != null) { myGeom.setLocalRotation(myDirection); } } }
pickUp.setShadowMode(ShadowMode.CastAndReceive); pickUp.setMaterial(materialYellow); pickUp.setLocalRotation(rotation.fromAngles( FastMath.rand.nextFloat() * FastMath.TWO_PI, FastMath.rand.nextFloat() * FastMath.TWO_PI,
@Override public void simpleUpdate(float tpf){ Quaternion q = new Quaternion(); angle += tpf; angle %= FastMath.TWO_PI; q.fromAngles(angle, 0, angle); offBox.setLocalRotation(q); offBox.updateLogicalState(tpf); offBox.updateGeometricState(); }
@Override public void simpleUpdate(float tpf){ Quaternion q = new Quaternion(); angle += tpf; angle %= FastMath.TWO_PI; q.fromAngles(angle, 0, angle); offBox.setLocalRotation(q); offBox.updateLogicalState(tpf); offBox.updateGeometricState(); }