Camera.setFrame

Hi! I’m new to jme, but I’m learning, eventually…

The thing is, I’ve looked and looked and I can’t seem to find any helpful information about navigating the camera. I think setFrame is the right method, and I’ve found a couple of threads about it, but I don’t understand how to use it.



setFrame(Vector3f location, Vector3f left, Vector3f up, Vector3f direction)

There are four vectors, right?

First one - Where I want the camera, right?

Left - the Y axis?

Up - the Z axis?

Direction - the X axis?



This is what I found in one of the threads:

“So left rotates it around on the Y axis (looking left and right over the ground), up rotates it on the Z axis, (looking above or below the horizon), and direction rotates it on the X axis (tilting your head to the side, or doing a barrel roll). Am I right so far? How much is full then? Does 1=360 degrees?”



Then there’s the answer, which I’m too stupid to understand.

http://www.jmonkeyengine.com/jmeforum/index.php?topic=4143.0 (The thread.)



I’d appriciate all help I can get, because jME is great and I’d love to get to know it better!

Thanks.

For simplicity, you should use setPosition and lookAt methods in the Camera class. These create the up, left and direction vectors for you. For the lookAt, you would typically use Vector3f.UNIT_Y as the up vector.

Thanks, that helps a lot!

If I tell the cam to look at a box, it follows the box around as I move it. But when I want an exact top down view, the box is gone.

I set the cams location at 0,0,0 (same as the box) and then I move the box up or down with the + and - buttons. Upwards, this works just fine (the camera looks up on the box from underneath), but when I move the box beneath the camera it disappears.

I get the same result when starting the game with the box over and/or underneath the camera. When the camera is looking up, the box is there, when looking down it's not.

Any idea on what's wrong?

Thanks again!

Looking directly down has a problem of not having the up vector defined as the UNIT_Y vector… instead, you might want to try using a UNIT_Z up in that particular case… This is due to the nature of Spherical Coordinates you can probably learn about in Wiki. (non-jme)

I'll try that. Thanks.