Camera Direction

Hi there, have the problem that when I change the camera direction… the "stuff" doesn't work  :expressionless: err… how can I say… look at my code:







various imports







public class Test extends SimpleGame {



public static void main(String[] args) {

  Test app = new Test();

  app.setDialogBehaviour(SimpleGame.ALWAYS_SHOW_PROPS_DIALOG);

  app.start();

}



protected void simpleInitGame() {

Node scene = new Node("scene");

rootNode.attachChild(scene);

File outfile = new File("stanza_01.xml");

Spatial s = loadFromXML(outfile);

scene.attachChild(s);



cam.setLocation(new Vector3f(-5f, 2f, 4.4f));

cam.setDirection(new Vector3f(0f, 0f, 0f));

}





public static Spatial loadFromXML(File toLoad){

                …

}

}





ok, you see that I move the camera in the point (-5f, 2f, 4.4f) and I want to see the point in (0f, 0f, 0f). the center of model that I load is in (0f, 0f, 0f), so I should see it… but instead is all black and if I move the mouse or I travel around with "A,W,D,S" it still remains a black screen.



any idea?

cam.lookAt is useful



Make sure that the UP is correct - usually something like new Vector3f(0,1,0)

mmm… there's something strange. in http://www.jmonkeyengine.com/doc/com/jme/renderer/Camera.html#lookAt(com.jme.math.Vector3f) it says that lookAt takes one Vector3f as parameter, while if I try to compile…



Test.java:53: lookAt(com.jme.math.Vector3f,com.jme.math.Vector3f) in com.jme.renderer.Camera cannot

be applied to (com.jme.math.Vector3f)

                cam.lookAt(new Vector3f(0f, 0f, 0f));

                  ^

1 error



and infact, if I try with:



          Vector3f pos = new Vector3f(0f, 0f, 0f);

          cam.lookAt(pos, pos);



then it compiles, but I don't know what the second Vector3f stands for (the way I tried still doesn't work).

documentation not up to date…nowdays it's camera.lookAt(Vector3f pos, Vector3f worldUpVector)

MrCoder said:

documentation not up to date...nowdays it's camera.lookAt(Vector3f pos, Vector3f worldUpVector)

Yes - JavaDoc on the webpage is for the latest release while you seem to use the nightly build - take the nightly build sources as JavaDoc source (you can generate them via the build script if you like).

ok thanks very much.