com.jme3.app.FlyCamAppState Java Examples

The following examples show how to use com.jme3.app.FlyCamAppState. 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: TestJaime.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void simpleInitApp() {
    stateManager.detach(stateManager.getState(FlyCamAppState.class));
    stateManager.detach(stateManager.getState(ResetStatsState.class));
    stateManager.detach(stateManager.getState(DebugKeysAppState.class));
    stateManager.detach(stateManager.getState(StatsAppState.class));
    final Node jaime = LoadModel();
    
    setupLights();        
    setupCamera();
    setupFloor();
    setupCinematic(jaime);
    setupInput();
}
 
Example #2
Source File: TestSceneStress.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public TestSceneStress() {
    super(new StatsAppState(), new DebugKeysAppState(), new BasicProfilerState(false),
          new FlyCamAppState(),
          new ScreenshotAppState("", System.currentTimeMillis())); 
}
 
Example #3
Source File: TestSceneStress.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
 
    stateManager.getState(FlyCamAppState.class).getCamera().setMoveSpeed(10);

    mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", ColorRGBA.Blue);

    // Create a deep, mostly static scene        
    Spatial oct = createOctSplit("root", 500, 5);
    
    rootNode.attachChild(oct);
 
    // Position to see most of it       
    cam.setLocation(new Vector3f(400.8009f, 370.16455f, -408.17984f));
    cam.setRotation(new Quaternion(0.24906662f, -0.3756747f, 0.105560325f, 0.88639235f));
    
    System.out.println("Total nodes:" + totalNodes + "  Total Geometry:" + totalGeometry + "  Total controls:" + totalControls );        
}
 
Example #4
Source File: TestChaseCameraAppState.java    From jmonkeyengine with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public void simpleInitApp() {
  // Load a teapot model
  teaGeom = (Geometry) assetManager.loadModel("Models/Teapot/Teapot.obj");
  Material mat_tea = new Material(assetManager, "Common/MatDefs/Misc/ShowNormals.j3md");
  teaGeom.setMaterial(mat_tea);
  rootNode.attachChild(teaGeom);

  // Load a floor model
  Material mat_ground = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
  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);
  rootNode.attachChild(ground);
  
  //disable the flyCam
  stateManager.detach(stateManager.getState(FlyCamAppState.class));   
     
  // Enable a chase cam  
  ChaseCameraAppState chaseCamAS = new ChaseCameraAppState();
  chaseCamAS.setTarget(teaGeom);
  stateManager.attach(chaseCamAS);
 
  //Uncomment this to invert the camera's vertical rotation Axis 
  //chaseCamAS.setInvertVerticalAxis(true);

  //Uncomment this to invert the camera's horizontal rotation Axis
  //chaseCamAS.setInvertHorizontalAxis(true);

  //Uncomment this to enable rotation when the middle mouse button is pressed (like Blender)
  //WARNING : setting this trigger disable the rotation on right and left mouse button click
  //chaseCamAS.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE));

  //Uncomment this to set multiple triggers to enable rotation of the cam
  //Here space bar and middle mouse button
  //chaseCamAS.setToggleRotationTrigger(new MouseButtonTrigger(MouseInput.BUTTON_MIDDLE),new KeyTrigger(KeyInput.KEY_SPACE));

  //registering inputs for target's movement
  registerInput();

}
 
Example #5
Source File: HelloJME3.java    From chuidiang-ejemplos with GNU Lesser General Public License v3.0 4 votes vote down vote up
public HelloJME3(){
    super(new StatsAppState(), new FlyCamAppState(), new AudioListenerState(), new DebugKeysAppState());
}