Objects disappear when using boundingboxes


I'm very new to jme and 3D programming in general so this is probably a dumb beginners mistake, but I couldn't find any answer to my problem in the forum or in any of the beginner guides, so here I go.

When I do the following to add a boundingbox my object

box.setModelBound(new BoundingBox());


the object starts to disappear from the scene when I move my camera.

There are certain camera positions where I can see the object an certain positions where I can't.

If I set rootNode.setCullMode(SceneElement.CULL_NEVER); the object doesn't disappear anymore but the boundingbox still does.

I have no Idea what is causing this behaviour, I hope some of your more experienced guys can give me some help.

Thanks in advance!

Maybe your cameras far or near plane are wrongly set up, which would cull the objects too early.

How is your set up ?

You are right it has something todo with my camera.

But the only thing I alter is the Position of the camera at startup.

Vector3f loc = new Vector3f(0.0f, 45.0f, 55.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, -1.0f);
      /** Move our camera to a correct place and orientation. */
      cam.setFrame(loc, left, up, dir);

If I comment that part out everything looks like it should be.
So what am I doing wrong with the camerasetup?

cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);

danmck said:

cam.setFrustumPerspective(45.0f, (float)width / (float)height, 1, 1000);


That doesn't help either.
As I previously said I'm just doing the things I posted above to alter the camera location of the standard camera that is built into the SimpleGame.
I've seen somewhere that the camera gets attached to its own node, is that maybe something Im missing?

it seems to work in TestSimpleBox, did you do a cam.update() after the change ?

Yes I did that.

And as I pointed out earlier I only get this behaviour if I add a boundingbox to an object.

All objects without boundingboxes get displayed just fine.

maybe its better to make a small example to show the problem you have.

That way its easier for others to reproduce.