Orthographic camera

Hi All,

I am tryng to create an orthogonal camera in top of my scene, my code looks like this:

                this.camOrtho = this.getRenderer().createCamera(this.getWidth(), this.getHeight());

this.camOrtho.setDirection(new Vector3f(0, -1, 0));

this.camOrtho.setLocation(new Vector3f(0.0f, 10.0f, 0.0f));




Doing this i don't see my scene, what i am making wrong?

I just ran into the same problems. It seams that all this is caused by the setDirection method of the Camera object.

I played a bit with the values and found that different lengths of the direction vector cause different camera behaviour.

e.g. (0.0f, -1.0f, -1.0f) causes the scene to be culled too early while (0.0f, -10.0f, -10.0f) works just fine.

Anyone mind enlighting me why the vector length of the camera vector matters? Is this maybe a jME bug?

Edit: I need to add something. I'm not using orthographic projection, but the normal perspective projection. Though, I wouldn't wonder if the problems are related to each other.

Hi mp,

We talked deeper in the following thread:



Reading the Javadoc comment helped a lot. Took me about an hour to figure out that Camera.setDirection is no method you should ever call alone.

setDirection sets the direction this camera is facing. In most cases, this changes the up and left vectors of the camera. If your left or up vectors change, you must updates those as well for correct culling.

Thus, if I call Camera.setDirection I also need to make sure that Camera.setTop and Camera.setLeft are called with the right values.

Bottom line: I will use Camera.setFrame. It does all in one step and you can't forget to set the up or left vector.