Dummy questions

Hello,



I am trying to see how easy I could write a roguelike with Jme and I am frankly impressed. Gone are the days of poking to A000:0000 :wink:



I have extended SimpleGame, added a few tiles and even loaded a model ( ninja.obj ) with remarkable ease.



I have some questions :


  • How do I get access to the Camera ?
  • can I just do a getDirection()/setDirection() and getLocation()/setLocation() ?
  • Can you make the camera follow an object ?

    How do textures work ? Let’s say I have a 64*64 texture, how large should my SquareTrimesh be to have like a 1 to 1 mapping ?
  • When I loaded ninja.obj I noticed that model is size 1, has there been an automatic resizing ?



    Cheers,

    T.

Hello,



I will just put all my questions on this thread instead of polluting the board.





I notice a lot of output when running my application, this means that the library could be faster by not generating these messages.

  • Is there an ant build target that does not generate these messages ?
  • Is there a way to only show critical messages ?

    I am asking this because in the flood of messages it is hard to spot the messages that matter and that actually show why he app is crashing down.



    Cheers,

    T.
- How do I get access to the Camera ?


The camera is just an object of type Camera created in SimpleGame. It's a protected member so you can just access it in your extended class. It's called "cam".

- can I just do a getDirection()/setDirection() and getLocation()/setLocation() ?


Basically .... for a list of all the methods and such take a look at the jME java docs located here: http://www.jmonkeyengine.com/doc/

You can set your camera direction by using the setFrame method.

You can give the camera a position vector, an up vector, a left vector and a direction vector.

- Can you make the camera follow an object ?

Yep ... in one line of code.

cam.setLocation(new Vector3f(x,y,z));



Just put that in your update method so it gets called every update.

How do textures work ? Let's say I have a 64*64 texture, how large should my SquareTrimesh be to have like a 1 to 1 mapping ?

Hmmm ... I'm not actually sure of the answer to this (the 1 to 1 mapping thing). In regards to how textures work you just create a TextureState and then add that state to your object.

Example ....

      TextureState tState = display.getRenderer().createTextureState();
      tState.setTexture(
            TextureManager.loadTexture(
                  YOUR CLASSNAME.class.getClassLoader().getResource("data/textures/flaresmall.jpg"),
                  Texture.MM_LINEAR_LINEAR,
                  Texture.FM_LINEAR)
      );
      tState.setEnabled(true);
      object.setRenderState(tState);




- When I loaded ninja.obj I noticed that model is size 1, has there been an automatic resizing ?

The model will be the same size as whatever it was in your modeling program. Now it's sometimes hard to tell if your game and your modeling program have the camera set up in the same way. When you say size do you mean scale? Whatever the original size of the model is will be a scale of 1. Then if you want to make it twice as big just setScale(2) or whatever it may be.
- Is there an ant build target that does not generate these messages ?
- Is there a way to only show critical messages ?


These messages are from the jME logging system. You can turn the logging system off by doing the following


LoggingSystem.getLogger().setLevel(java.util.logging.Level.OFF);



You can set the logging to other levels as well to fine tune which messages you get.