Cameranode orientation twitchiness

hiya everybody!

i'm having some trouble getting my cameras to orient themselves correctly. when the scene i'm using is loaded using the colladaimporter, the up direction of the camera isn't the world up direction (UNIT_Z), but is rather off by a bit so that the camera looks downward. however, because of this, when the camera is rotated to the right or left, the camera is still tilted in that direction, and the camera isn't upright with respect to the world its situated within.

so… i'm using a wrapper class that takes care of a bunch of camera stuff, and implemented a method that is supposed to relevel the camera when a flag is set. however it doesn't quite work. this is what i have:

public void reLevel() {

if ( needsLevel ) {

getCamera().update();

Vector3f dir = getCamera().getDirection();

Vector3f lookat = getCameraNode().getLocalTranslation().add(dir);

getCameraNode().lookAt(lookat, Vector3f.UNIT_Z);

needsLevel = false;

}

}

this is fine for small offsets from the original viewing direction, but if i want to look far off to the right or left, the camera motion twitches and slows down a lot, and the camera seems to stop rotating at all at some point. I have a feeling that this is due to the fact that the cameranode rotates the camera so that the unit_z direction is always the forward direction of the cameranode, but i can't figure out how to solve this issue.



anyone out there more familiar with the cameras?

The lookAt method takes as its second argument the direction of the UP vector, you are using UNIT_Z as your up, instead of the usual UNIT_Y… is this intended?