@Override public void simpleUpdate(float tpf) { cam.lookAt(carNode.getWorldTranslation(), Vector3f.UNIT_Y); } }
@Override public void simpleUpdate(float tpf) { cam.lookAt(vehicle.getPhysicsLocation(), Vector3f.UNIT_Y); }
@Override public void simpleUpdate(float tpf) { Quaternion quat=new Quaternion(); cam.lookAt(vehicle.getPhysicsLocation(), Vector3f.UNIT_Y); }
public void simpleInitApp() { original = new Sphere(4, 4, 1); original.setStatic(); //original.setInterleaved(); // this will make sure all spheres are rendered always rootNode.setCullHint(CullHint.Never); solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); cam.setLocation(new Vector3f(0, 5, 0)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); Logger.getLogger(Node.class.getName()).setLevel(Level.WARNING); Logger.getLogger(NativeObjectManager.class.getName()).setLevel(Level.WARNING); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(3, 3, 3)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); Texture offTex = setupOffscreenView(); Spatial sky = SkyFactory.createSky(assetManager, offTex, EnvMapType.CubeMap); rootNode.attachChild(sky); }
@Override public void simpleInitApp() { Sphere sphMesh = new Sphere(14, 14, 1); Material solidColor = assetManager.loadMaterial("Common/Materials/RedColor.j3m"); for (int y = -5; y < 5; y++){ for (int x = -5; x < 5; x++){ Geometry sphere = new Geometry("sphere", sphMesh); sphere.setMaterial(solidColor); sphere.setLocalTranslation(x * 2, 0, y * 2); rootNode.attachChild(sphere); } } cam.setLocation(new Vector3f(0, 5, 0)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); }
/** * Forcefully takes over Camera adding functionality and placing it behind the character * @param tpf Tickes Per Frame */ private void camTakeOver(float tpf) { cam.setLocation(player.getLocalTranslation().add(-8, 2, 0)); cam.lookAt(player.getLocalTranslation(), Vector3f.UNIT_Y); Quaternion rot = new Quaternion(); rot.fromAngleNormalAxis(camAngle, Vector3f.UNIT_Z); cam.setRotation(cam.getRotation().mult(rot)); camAngle *= FastMath.pow(.99f, fpsRate * tpf); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(2,1.5f,2)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); putArrow(Vector3f.ZERO, Vector3f.UNIT_X, ColorRGBA.Red); putArrow(Vector3f.ZERO, Vector3f.UNIT_Y, ColorRGBA.Green); putArrow(Vector3f.ZERO, Vector3f.UNIT_Z, ColorRGBA.Blue); putBox(new Vector3f(2, 0, 0), 0.5f, ColorRGBA.Yellow); putGrid(new Vector3f(3.5f, 0, 0), ColorRGBA.White); putSphere(new Vector3f(4.5f, 0, 0), ColorRGBA.Magenta); }
@Override public void simpleInitApp() { /** Set up Physics Game */ bulletAppState = new BulletAppState(); stateManager.attach(bulletAppState); //bulletAppState.getPhysicsSpace().enableDebug(assetManager); /** Configure cam to look at scene */ cam.setLocation(new Vector3f(0, 4f, 6f)); cam.lookAt(new Vector3f(2, 2, 0), Vector3f.UNIT_Y); /** Initialize the scene, materials, inputs, and physics space */ initInputs(); initMaterials(); initWall(); initFloor(); initCrossHairs(); }
@Override public void simpleInitApp() { cam.setLocation(new Vector3f(3, 3, 3)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); //setup main scene Geometry quad = new Geometry("box", new Box(1, 1, 1)); Texture offTex = setupOffscreenView(); Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", offTex); quad.setMaterial(mat); rootNode.attachChild(quad); inputManager.addMapping(TOGGLE_UPDATE, new KeyTrigger(KeyInput.KEY_SPACE)); inputManager.addListener(this, TOGGLE_UPDATE); }
public void updateCamera() { rootNode.updateGeometricState(); Vector3f pos = spaceCraft.getWorldTranslation().clone(); Quaternion rot = spaceCraft.getWorldRotation(); Vector3f dir = rot.getRotationColumn(2); // make it XZ only Vector3f camPos = new Vector3f(dir); camPos.setY(0); camPos.normalizeLocal(); // negate and multiply by distance from object camPos.negateLocal(); camPos.multLocal(15); // add Y distance camPos.setY(2); camPos.addLocal(pos); cam.setLocation(camPos); Vector3f lookAt = new Vector3f(dir); lookAt.multLocal(7); // look at dist lookAt.addLocal(pos); cam.lookAt(lookAt, Vector3f.UNIT_Y); }
/** * Creates the camera to use for rendering. Default values are perspective * projection with 45° field of view, with near and far values 1 and 1000 * units respectively. */ private void initCamera(){ cam = new Camera(settings.getWidth(), settings.getHeight()); cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f); cam.setLocation(new Vector3f(0f, 0f, 10f)); cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y); renderManager = new RenderManager(renderer); //Remy - 09/14/2010 setted the timer in the renderManager renderManager.setTimer(timer); viewPort = renderManager.createMainView("Default", cam); viewPort.setClearFlags(true, true, true); // Create a new cam for the gui Camera guiCam = new Camera(settings.getWidth(), settings.getHeight()); guiViewPort = renderManager.createPostView("Gui Default", guiCam); guiViewPort.setClearFlags(false, false, false); }
private void initScene() { //init cam location cam.setLocation(new Vector3f(0, 10, 10)); cam.lookAt(Vector3f.ZERO, Vector3f.UNIT_Y); //init scene sceneNode = new Node("Scene"); mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md"); mat.setTexture("ColorMap", assetManager.loadTexture("Interface/Logo/Monkey.jpg")); Box b = new Box(1, 1, 1); Geometry geom = new Geometry("Box", b); geom.setMaterial(mat); sceneNode.attachChild(geom); // load sky sceneNode.attachChild(SkyFactory.createSky(assetManager, "Textures/Sky/Bright/BrightSky.dds", SkyFactory.EnvMapType.CubeMap)); rootNode.attachChild(sceneNode); //add lightPos Geometry Sphere lite=new Sphere(8, 8, 3.0f); lightSphere=new Geometry("lightsphere", lite); lightSphere.setMaterial(mat); lightSphere.setLocalTranslation(lightPos); rootNode.attachChild(lightSphere); }
/** * Creates the camera to use for rendering. Default values are perspective * projection with 45° field of view, with near and far values 1 and 1000 * units respectively. */ private void initCamera(){ cam = new Camera(settings.getWidth(), settings.getHeight()); cam.setFrustumPerspective(45f, (float)cam.getWidth() / cam.getHeight(), 1f, 1000f); cam.setLocation(new Vector3f(0f, 0f, 10f)); cam.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y); renderManager = new RenderManager(renderer); //Remy - 09/14/2010 setted the timer in the renderManager renderManager.setTimer(timer); if (prof != null) { renderManager.setAppProfiler(prof); } viewPort = renderManager.createMainView("Default", cam); viewPort.setClearFlags(true, true, true); // Create a new cam for the gui Camera guiCam = new Camera(settings.getWidth(), settings.getHeight()); guiViewPort = renderManager.createPostView("Gui Default", guiCam); guiViewPort.setClearFlags(false, false, false); }
offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL); // bulletAppState.setEnabled(false); stateManager.attach(bulletAppState); bullet = new Sphere(32, 32, 0.4f, true, false); bullet.setTextureMode(TextureMode.Projected); bulletCollisionShape = new SphereCollisionShape(0.4f); brick = new Box(brickWidth, brickHeight, brickDepth); brick.scaleTextureCoordinates(new Vector2f(1f, .5f)); //bulletAppState.getPhysicsSpace().enableDebug(assetManager); initMaterial(); initTower(); initFloor(); initCrossHairs(); this.cam.setLocation(new Vector3f(0, 25f, 8f)); cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0)); cam.setFrustumFar(80); inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "shoot"); rootNode.setShadowMode(ShadowMode.Off); }
offCamera.lookAt(new Vector3f(0f, 0f, 0f), Vector3f.UNIT_Y);
@Override public void simpleInitApp() { bulletAppState = new BulletAppState(); bulletAppState.setThreadingType(BulletAppState.ThreadingType.PARALLEL); stateManager.attach(bulletAppState); bullet = new Sphere(32, 32, 0.4f, true, false); bullet.setTextureMode(TextureMode.Projected); bulletCollisionShape = new SphereCollisionShape(0.4f); brick = new Box(bLength, bHeight, bWidth); brick.scaleTextureCoordinates(new Vector2f(1f, .5f)); initMaterial(); initWall(); initFloor(); initCrossHairs(); this.cam.setLocation(new Vector3f(0, 6f, 6f)); cam.lookAt(Vector3f.ZERO, new Vector3f(0, 1, 0)); cam.setFrustumFar(15); inputManager.addMapping("shoot", new MouseButtonTrigger(MouseInput.BUTTON_LEFT)); inputManager.addListener(actionListener, "shoot"); inputManager.addMapping("gc", new KeyTrigger(KeyInput.KEY_X)); inputManager.addListener(actionListener, "gc"); rootNode.setShadowMode(ShadowMode.Off); }
cam.lookAt(new Vector3f(4,0,-7), Vector3f.UNIT_Y);
cam.lookAt(player.getPhysicsLocation(), Vector3f.UNIT_Y);