I am becoming crazy with jme

Hello, i am trying to develop a game using jme. But every thing i try to do becomes a hard task, because into the docs i can not find anything. It's only me or there are any other developer with my problem?.

do you use jm2 or jm3 ?

I suggest you to try with jm3, although it is alpha and not stable yet, but it is easier to learn than jm2

follow the tuts from zathras

http://www.jmonkeyengine.com/wiki/doku.php/jme3

good luck

for any manipulation of the camera i would advise using the lookAt method of the camera itself and it will recalculate the viewing frustrum and associated parameters…

I've only been at it a few days, but following the wiki tutorials here - http://www.jmonkeyengine.com/wiki/doku.php introduces you to many of the classes and helps you to know what to look for in the docs, and the docs are helpful.

Thank you, but for example in the wiki tutorial does not say how to programe the camera because always use the camera of simplegame o basegame, and i use standargame with gamestates.

So you’re using jME2 then?



From DebugGameState:

protected void cameraPerspective() {
        DisplaySystem display = DisplaySystem.getDisplaySystem();
        Camera cam = display.getRenderer().getCamera();
        cam.setFrustumPerspective(45.0f, (float) display.getWidth()
                / (float) display.getHeight(), 1, 1000);
        cam.setParallelProjection(false);
        cam.update();
    }

Thank you, and yes i am using jme2 because i had a project already started. That portion of code i knew but i cant find where to move the camera, because i tried with setFrame function, but when i want to rotate the cam, it does not work like i hope. Because of this i posted all this.

@antu:

Dude, stop crying and start asking real questions about problems!

Are you asking how to move and rotate the camera then?  Try the setLocation() and setDirection() methods if you haven't :slight_smile:

I tried it when i was not using cameranode, setlocation worked fine, but setdirection transformed the 3d object rarely. And now i am trying to use cameranode, but when i use the setlocaltranslation and setlocalrotation, the cameranode does not move.


public void setCamera(){
      try{
         display= DisplaySystem.getDisplaySystem();
      
         cam = display.getRenderer().createCamera(display.getWidth(),
            display.getHeight());
      } catch (JmeException e) {         
         System.out.println("Could not create displaySystem");
         System.exit(1);
      }      
      cam.setFrustumPerspective(45.0f, (float) display.getWidth()
         / (float) display.getHeight(), 1, 1000);      
      loc = new Vector3f(5.0f, 8.0f, 10.0f);      
      camNode = new CameraNode("Camera Node", cam);
      camNode.setLocalTranslation(loc);
      getRootNode().attachChild(camNode);
      camNode.updateWorldData(0);            
   }

public void update(float tpf){
      
      rootNode.updateGeometricState(tpf, true);
      
      if (KeyBindingManager.getKeyBindingManager().isValidCommand(
            "camera_forward", false)) {
         camNode.setLocalTranslation(camNode.getLocalTranslation().add(0.1f, 0.1f, 0.1f));
         camNode.updateWorldData(0);
         System.out.println("UP");
      }
      if (KeyBindingManager.getKeyBindingManager().isValidCommand(
            "camera_left", true)) {            
         System.out.println("LEFT");
      }      
      if (KeyBindingManager.getKeyBindingManager().isValidCommand(
            "camera_back", true)) {      
         System.out.println("BACK");
      }
      if (KeyBindingManager.getKeyBindingManager().isValidCommand(
            "camera_right", true)) {   
         System.out.println("RIGHT");
      }      
      
   }   

look in the jmetest package, there are tests for almost every feature.

If i want to know how to use a specific class, i go and search for all references to this class (use your IDE of choice) that way you will get a lot of example code and you can learn how things work.