CameraNode works pretty much backward

CameraNode works backward. The camera is aligned with +Z of the CameraNode, and not -Z which is the standard “forward” facing.

The following test demonstrates this, by placing a brick box at 0,0,-5 and a white one at 0,0,5

A CameraNode is added to the scene and tied to the camera so that the camera will follow the CameraNode

One should then be looking at the brick box, but instead, one sees the white box.

Conclusion: the camera is yawed 180 degrees from forward.



import com.jme3.material.Material;

import com.jme3.math.Vector3f;

import com.jme3.scene.CameraNode;

import com.jme3.scene.Geometry;

import com.jme3.scene.control.CameraControl;

import com.jme3.scene.shape.Box;

public class CameraNodeTest extends SimpleApplication {

public static void main(String[] args) {

CameraNodeTest app = new CameraNodeTest();



Geometry addBox(boolean brick, Vector3f where) {

Geometry box = new Geometry(“Box”, new Box(Vector3f.ZERO, .5f, .5f, .5f)) ;

Material mat = new Material(

getAssetManager(), “Common/MatDefs/Misc/Unshaded.j3md”);

if (brick)

mat.setTexture(“ColorMap”, getAssetManager().loadTexture(“Textures/Terrain/BrickWall/BrickWall.jpg”));




return box;



public void simpleInitApp() {

CameraNode cNode = new CameraNode(“cnode”, getCamera());



addBox(true, new Vector3f(0f, 0f, -5f));

addBox(false, new Vector3f(0f, 0f, 5f));




I think this is (undocumented??) expected behavior. Following is Camera#getDirection():



  • <code>getDirection</code> retrieves the direction vector the camera is
  • facing.

  • @return the direction the camera is facing.
  • @see Camera#getDirection()


    public Vector3f getDirection() {

    return rotation.getRotationColumn(2);


    I guess rotation.getRotationColumn(2); returns the projection of the third axis (z) by the quaternion (documentation isn’t very clear). Then camera’s direction would be were the Z-axis is pointing, thus no rotation means looking at (0,0,1). Hope this helps.

To minimize confusion, gotchas and questions, the design should be rich in consistent behaviors the average user would anticipate.


I don’t think consistency was foremost in the minds of the developers when they implemented jME3. This is only diagonally related, but I have been annoyed many times by the fact that transformations are handled differently for different types of objects. Spatials, lights, cameras; their translation/rotation transformations should all inherit from one common ancestor which forces them to use the exact same methods, but instead they are different.

I suppose you just have to get used to the inconsistencies for now. Hopefully they will be ironed out before a final release. Remember, we are all basically participating in a public test of an unfinished product which was only recently labeled as “beta.” Not that version identifiers like that really mean much, but still, that means it is likely (hopefully) to change eventually.

I don’t understand why you would think the standard is -Z? Creating a new Camera or CameraNode initializes it with default rotation values. The jME3 application class explicitly sets the direction to -Z. If you don’t like the default values you can change them, its not a problem

Because OpenGL’s standard is -Z?

The ModelView matrix contains both modelling and viewing transformations that place the viewer at the origin with the view direction aligned with the negative Z axis.


The problem is that there is no documentation saying that jME3 uses +Z as viewing axis.

Read again, it says “the viewer”, thats so that he sees models from the front (positive z). I think there is information on the fact that y-up z-forward is the default for jME3.

1 Like