I try to do some rotation around the center of a node. I managed to use the NodeHandler for this:
Vector3f center = ((OrientedBoundingBox) node.getWorldBound()).getCenter();
_camNode = new CameraNode("Camera Node", cam);
_input3 = new NodeHandler(_camNode, 10, 1f);
This works, but brings the camera in the center of the node. I would like to have the same rotate behavior, but "observe" it from the outside of the node, not from its center. I didn't manage to do this using the ChaseCamera. Can anyone help?
Maybe this can help you a bit along the way:
(Has some outside references and no javadoc, but you should be able to get the drift)
The outside references are for the Vector3f which is Left and Up in your world.
You could try to retrieve from Camera. (Major WIP)
If you have any experience with Java3D, this handler class should look familiar.
You can Tilt/Pan/Zoom and move center if roaming is turned on.
The exact answer to your problem would be to translate the camera within the CameraNode, or better yet:
To make a "Pivot" Node, attach the CameraNode within that, translate the CameraNode and attach the "Pivot" Node to the point you want to rotate around.
You can then perform all rotations/translations on the pivot node, and use CameraNode translation for zooming functions.
Hmm, or you could use setLocalScale()…
I tried the "pivot" node approach and I got it almost working. In some use cases, it works, but when the camera axes are set to different values, the rotate works strange: moving the mouse up rotates the object left and so on…
Do you have any idea what I could do to fix that?