# No objects appear until I move the camera a tiny bit

Hi everyone,

I’m having an odd problem. I have 5 nodes that should be drawn and visible on the screen. However, when I start the program up nothing is visible. Nothing shows up until I move the camera using the mouse. THe thing is I only have to tap the mouse and get it to move just a bit (even a single pixel of mouse movement) and then everything just appears on screen.

My guess I’m missing some kind of initialization or somewhere? It’s almost like the camera is off until I move a tiny bit to turn on.

I’m almost positive the objects are there in the right spot and that the camera is facing the right direction because it only takes the slightest movement to get everything to appear all at once in the correct positions.

Does anyone have any ideas what might be wrong?

you are close, but by making up (0, 0, 1) you just put your camera in a left handed coordinate system. This will look right when things are not moving, but once you start moving things are going to get a little odd. You’ll either want to make left (1, 0, 0) or up (0, 0, -1).

Okay that makes a lot of sense now!! Thanks!!

Here’s what I did.

Vector3f pos = new Vector3f(0.0f, 40.0f, 0.0f);

Vector3f left = new Vector3f( -1.0f, 0.0f, 0.0f);

Vector3f up = new Vector3f(0.0f, 0.0f, 1.0f);

Vector3f dir = new Vector3f(0.0f, -1.0f, 0.0f);

Everything seems to be working now fine but just to confirm my understanding. This creates a camera sitting above the x,z plane. Looking down on the x,z plane.

Thanks for all your help and patience.

the up is the “up” of the camera itself. Think of an actual video camera, when you are filming your lovely family at the beach, you are facing the camera towards the water, then up is towards the sky. Same thing here.

If you want your camera facing down the y you’d have up as (0, 0, -1)

Think of the up/left/direction like a graph paper.

On paper, up the page is Y, left and right is the X. Now imaging that you stack alot of those graph paper on top of this one, that depth would be your direction, aka Z.

Btw, the graph paper is flat in your eyes…

Shoot … I tried adding the bounding boxes to all 5 objects and now thing appears at all even when I move the mouse around

"mojomonk" wrote:
you have the camera up as (0, 1, 0) and it's direction as (0, -1, 0), up and direction can't be opposite.

Isn't direction the direction the camera is facing and up is the up axis? So having them opposite would create a camera that was pointing down? Just a little confused about how that works.

Gonna try the bounding box thing now.

Making both up and dir (0,-1,0) didn't solve the problem though I'm sure it would have caused problems elsewhere.

I think Mojo nailed it… the camera axis get "fixed" (usually) on mouse movement. You just have to make sure they are good from the start.

you have the camera up as (0, 1, 0) and it’s direction as (0, -1, 0), up and direction can’t be opposite.

huston, we have lift off! lol, add this line at the end of your boxes:

``` Box b = new Box("Hello", new Vector3f(0, 0, 0), 0.2f, 0.4f); b.setModelBound(new BoundingBox()); ... ```

Does that solve it?

DP

The nodes I’m using are just premade boxes that are included as part of jME.

Not sure if those have bounding boxes.

Here is my camera init code located in my version of SimpleGame in the initSystem() method

```   protected final void initSystem() {      //createDisplay      //createCamera                  ////  Creating Display /////     try {         /** Get a DisplaySystem acording to the renderer selected in the startup box. */       display = DisplaySystem.getDisplaySystem(properties.getRenderer());        /** Create a window with the startup box's information. */       display.createWindow(           properties.getWidth(),           properties.getHeight(),           properties.getDepth(),           properties.getFreq(),           properties.getFullscreen());             /** Set a black background.*/           }     catch (JmeException e) {        /** If the displaysystem can't be initialized correctly, exit instantly. */        e.printStackTrace();        System.exit(1);     }     /////// Creating Camera ///////////     /** Create a camera specific to the DisplaySystem that works with      * the display's width and height*/      cam = display.getRenderer().createCamera(                display.getWidth(),             display.getHeight());     /** Set up how our camera sees. */     cam.setFrustumPerspective(45.0f,                               (float) display.getWidth() /                               (float) display.getHeight(), 1, 1000);     Vector3f pos = new Vector3f(0.0f, 40.0f, 0.0f);     Vector3f left = new Vector3f( -1.0f, 0.0f, 0.0f);     Vector3f up = new Vector3f(0.0f, 1.0f, 0.0f);     Vector3f dir = new Vector3f(0.0f, -1.0f, 0.0f);       /** Move our camera to a correct place and orientation. */     cam.setFrame(pos, left, up, dir);       /** Signal that we've changed our camera's location/frustum. */           /** Assign the camera to this renderer.*/     cam.update();         display.getRenderer().setCamera(cam);     display.getRenderer().setBackgroundColor(ColorRGBA.black);     display.setTitle("Space Game");       /** Signal to the renderer that it should keep track of rendering information. */     display.getRenderer().enableStatistics(true);         ////// Creating Input Controller     /** Create a basic input controller. */     ship = new ShipTriMesh("my ship");     input = new ShipMovementHandler(this, cam, properties.getRenderer(), ship);         /** Signal to all key inputs they should work 10x faster. */     input.setKeySpeed(10f);     input.setMouseSpeed(1f);       /** Get a high resolution timer for FPS updates. */     timer = Timer.getTimer(properties.getRenderer());     // Create KeyBindings       /** Assign key T to action "toggle_wire". */     KeyBindingManager.getKeyBindingManager().set(         "toggle_wire",         KeyInput.KEY_T);       /** Assign key L to action "toggle_lights". */     KeyBindingManager.getKeyBindingManager().set(         "toggle_lights",         KeyInput.KEY_L);       /** Assign key B to action "toggle_bounds". */     KeyBindingManager.getKeyBindingManager().set(         "toggle_bounds",         KeyInput.KEY_B);       /** Assign key C to action "camera_out". */     KeyBindingManager.getKeyBindingManager().set(         "camera_out",         KeyInput.KEY_C);     /** Assign key R to action "ship_rotation". */     KeyBindingManager.getKeyBindingManager().set(         "ship_rotation",         KeyInput.KEY_R);     KeyBindingManager.getKeyBindingManager().set(             "ship_translate",             KeyInput.KEY_Y);        } ```

Is it a problem that I made the ship node before I set up the input system? Right now the ShipMovementHandler has the camera movement code in it. I haven't seperated it yet.

ive had this problem before…can’t remeber how i solved it tho :?

Do your nodes have bounds around them? I think that was the problem IIRC…

If they dont, obtain the geometries they contain and call setBoundingVolume(new BoundingBox()); on each geometry.

DP

ok, how are you setting up your camera?

cam.update is being called

"mojomonk" wrote:
did you call

camera.update() after changing the camera attributes?

Mmm, yeah, that could effect culling too. The moving of the mouse would cause the camera to update, thus the popin effect.

The FPS Counter shows up and it shows the correct number of triangles being drawn.

did you call

camera.update() after changing the camera attributes?

Does the fps counter show up when you first start, and if so, does it show that no tris are being drawn? I’m guessing it’s a cull issue of some kind. Are you using a certain bounding type?

I’m using a modified simpleGame. I really only changed the camera attributes. In addition I’m using a modified CamMovementCOntroller. The only thing I changed was to add some custom keys for node movement.

In my modified simpleGame updateGeometricState is being called on the rootNode and the fpsNode. Do I need to call this on all the nodes that are visible? I actually just tested and added an updateGeometricState and updateRenderState to my other nodes and it didn’t seem to help. On second thought since everything is attached to the RootNode calling updateGeometricState on the other nodes shouldn’t be necessary I suppose.

First question are you using simple game?

If not, are you calling updateGeometricState after building your scene?