Java Code Examples for com.jme3.scene.Node#move()
The following examples show how to use
com.jme3.scene.Node#move() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestSweepTest.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 6 votes |
@Override public void simpleInitApp() { obstacleCollisionShape = new CapsuleCollisionShape(0.3f, 0.5f); capsuleCollisionShape = new CapsuleCollisionShape(1f, 1f); stateManager.attach(bulletAppState); capsule = new Node("capsule"); capsule.move(-2, 0, 0); capsule.addControl(new RigidBodyControl(capsuleCollisionShape, 1)); capsule.getControl(RigidBodyControl.class).setKinematic(true); bulletAppState.getPhysicsSpace().add(capsule); rootNode.attachChild(capsule); obstacle = new Node("obstacle"); obstacle.move(2, 0, 0); RigidBodyControl bodyControl = new RigidBodyControl(obstacleCollisionShape, 0); obstacle.addControl(bodyControl); bulletAppState.getPhysicsSpace().add(obstacle); rootNode.attachChild(obstacle); bulletAppState.setDebugEnabled(true); }
Example 2
Source File: TestJaime.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
public void setupCinematic(final Node jaime) { cinematic = new Cinematic(rootNode, 60); stateManager.attach(cinematic); jaime.move(0, 0, -3); AnimationFactory af = new AnimationFactory(0.7f, "JumpForward"); af.addTimeTranslation(0, new Vector3f(0, 0, -3)); af.addTimeTranslation(0.35f, new Vector3f(0, 1, -1.5f)); af.addTimeTranslation(0.7f, new Vector3f(0, 0, 0)); jaime.getControl(AnimControl.class).addAnim(af.buildAnimation()); cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "Idle",3, LoopMode.DontLoop)); float jumpStart = cinematic.enqueueCinematicEvent(new AnimationEvent(jaime, "JumpStart", LoopMode.DontLoop)); cinematic.addCinematicEvent(jumpStart+0.2f, new AnimationEvent(jaime, "JumpForward", LoopMode.DontLoop,1)); cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "JumpEnd", LoopMode.DontLoop)); cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Punches", LoopMode.DontLoop)); cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "SideKick", LoopMode.DontLoop)); float camStart = cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Taunt", LoopMode.DontLoop)); cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Idle",1, LoopMode.DontLoop)); cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Wave", LoopMode.DontLoop)); cinematic.enqueueCinematicEvent( new AnimationEvent(jaime, "Idle", LoopMode.DontLoop)); CameraNode camNode = cinematic.bindCamera("cam", cam); camNode.setLocalTranslation(new Vector3f(1.1f, 1.2f, 2.9f)); camNode.lookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y); MotionPath path = new MotionPath(); path.addWayPoint(new Vector3f(1.1f, 1.2f, 2.9f)); path.addWayPoint(new Vector3f(0f, 1.2f, 3.0f)); path.addWayPoint(new Vector3f(-1.1f, 1.2f, 2.9f)); path.enableDebugShape(assetManager, rootNode); path.setCurveTension(0.8f); MotionEvent camMotion = new MotionEvent(camNode, path,6); camMotion.setDirectionType(MotionEvent.Direction.LookAt); camMotion.setLookAt(new Vector3f(0, 0.5f, 0), Vector3f.UNIT_Y); cinematic.addCinematicEvent(camStart, camMotion); cinematic.activateCamera(0, "cam"); cinematic.fitDuration(); cinematic.setSpeed(1.2f); cinematic.setLoopMode(LoopMode.Loop); cinematic.play(); }
Example 3
Source File: TestAnimMigration.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { setTimer(new EraseTimer()); cam.setFrustumPerspective(45f, (float) cam.getWidth() / cam.getHeight(), 0.1f, 100f); viewPort.setBackgroundColor(ColorRGBA.DarkGray); rootNode.addLight(new DirectionalLight(new Vector3f(-1, -1, -1).normalizeLocal())); rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray)); Spatial model = assetManager.loadModel("Models/Jaime/Jaime.j3o"); // Spatial model = assetManager.loadModel("Models/Oto/Oto.mesh.xml").scale(0.2f).move(0, 1, 0); //Spatial model = assetManager.loadModel("Models/Sinbad/Sinbad.mesh.xml"); //Spatial model = assetManager.loadModel("Models/Elephant/Elephant.mesh.xml").scale(0.02f); AnimMigrationUtils.migrate(model); rootNode.attachChild(model); debugAppState = new ArmatureDebugAppState(); stateManager.attach(debugAppState); setupModel(model); flyCam.setEnabled(false); Node target = new Node("CamTarget"); //target.setLocalTransform(model.getLocalTransform()); target.move(0, 1, 0); ChaseCameraAppState chaseCam = new ChaseCameraAppState(); chaseCam.setTarget(target); getStateManager().attach(chaseCam); chaseCam.setInvertHorizontalAxis(true); chaseCam.setInvertVerticalAxis(true); chaseCam.setZoomSpeed(0.5f); chaseCam.setMinVerticalRotation(-FastMath.HALF_PI); chaseCam.setRotationSpeed(3); chaseCam.setDefaultDistance(3); chaseCam.setMinDistance(0.01f); chaseCam.setZoomSpeed(0.01f); chaseCam.setDefaultVerticalRotation(0.3f); initInputs(); }
Example 4
Source File: TestAnimSerialization.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { setTimer(new EraseTimer()); //cam.setFrustumPerspective(90f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 10f); viewPort.setBackgroundColor(ColorRGBA.DarkGray); rootNode.addLight(new DirectionalLight(new Vector3f(-1, -1, -1).normalizeLocal())); rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray)); Spatial model = assetManager.loadModel("Models/Jaime/Jaime.j3o"); AnimMigrationUtils.migrate(model); File storageFolder = JmeSystem.getStorageFolder(); file = new File(storageFolder.getPath() + File.separator + "newJaime.j3o"); BinaryExporter be = new BinaryExporter(); try { be.save(model, file); } catch (IOException e) { e.printStackTrace(); } assetManager.registerLocator(storageFolder.getPath(), FileLocator.class); model = assetManager.loadModel("newJaime.j3o"); rootNode.attachChild(model); debugAppState = new ArmatureDebugAppState(); stateManager.attach(debugAppState); setupModel(model); flyCam.setEnabled(false); Node target = new Node("CamTarget"); //target.setLocalTransform(model.getLocalTransform()); target.move(0, 1, 0); ChaseCameraAppState chaseCam = new ChaseCameraAppState(); chaseCam.setTarget(target); getStateManager().attach(chaseCam); chaseCam.setInvertHorizontalAxis(true); chaseCam.setInvertVerticalAxis(true); chaseCam.setZoomSpeed(0.5f); chaseCam.setMinVerticalRotation(-FastMath.HALF_PI); chaseCam.setRotationSpeed(3); chaseCam.setDefaultDistance(3); chaseCam.setMinDistance(0.01f); chaseCam.setZoomSpeed(0.01f); chaseCam.setDefaultVerticalRotation(0.3f); initInputs(); }
Example 5
Source File: TestAnimMorphSerialization.java From jmonkeyengine with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void simpleInitApp() { setTimer(new EraseTimer()); //cam.setFrustumPerspective(90f, (float) cam.getWidth() / cam.getHeight(), 0.01f, 10f); viewPort.setBackgroundColor(ColorRGBA.DarkGray); //rootNode.addLight(new DirectionalLight(new Vector3f(-1, -1, -1).normalizeLocal())); //rootNode.addLight(new AmbientLight(ColorRGBA.DarkGray)); Node probeNode = (Node) assetManager.loadModel("Scenes/defaultProbe.j3o"); rootNode.attachChild(probeNode); Spatial model = assetManager.loadModel("Models/gltf/zophrac/scene.gltf"); File storageFolder = JmeSystem.getStorageFolder(); file = new File(storageFolder.getPath() + File.separator + "zophrac.j3o"); BinaryExporter be = new BinaryExporter(); try { be.save(model, file); } catch (IOException e) { e.printStackTrace(); } assetManager.registerLocator(storageFolder.getPath(), FileLocator.class); Spatial model2 = assetManager.loadModel("zophrac.j3o"); model2.setLocalScale(0.1f); probeNode.attachChild(model2); debugAppState = new ArmatureDebugAppState(); stateManager.attach(debugAppState); setupModel(model2); flyCam.setEnabled(false); Node target = new Node("CamTarget"); //target.setLocalTransform(model.getLocalTransform()); target.move(0, 0, 0); ChaseCameraAppState chaseCam = new ChaseCameraAppState(); chaseCam.setTarget(target); getStateManager().attach(chaseCam); chaseCam.setInvertHorizontalAxis(true); chaseCam.setInvertVerticalAxis(true); chaseCam.setZoomSpeed(0.5f); chaseCam.setMinVerticalRotation(-FastMath.HALF_PI); chaseCam.setRotationSpeed(3); chaseCam.setDefaultDistance(3); chaseCam.setMinDistance(0.01f); chaseCam.setZoomSpeed(0.01f); chaseCam.setDefaultVerticalRotation(0.3f); initInputs(); }