Just to make sure I am tracking, you want to be able to both rotate the object seperately from camera and also be able to rotate it in conjunction with the camera, correct?
One thing you could do is create a camera "pivot / satelite" type of setup, something like this (I am not at a computer where I can test this, so let me know if it doesn't work):
Varriables needed:
private Object3D cameraPivot = null;
private Object3D cameraSatellite = null;
private Camera camera = null;
Set up the camera assembly:
private void initCamera()
{
cameraPivot = Object3D.createDummyObj();
cameraSatellite = Object3D.createDummyObj();
// distance you want the camera to start out:
cameraSatellite.translate( new SimpleVector( 0, 0, -20 ) );
cameraPivot.addChild( cameraSatellite );
camera = world.getCamera();
resetCameraPosition();
}
Align the actual camera up with the camera satellite and pivot objects:
private void resetCameraPosition()
{
SimpleVector look = new SimpleVector( cameraPivot.getZAxis() )
.normalize();
SimpleVector up = new SimpleVector( cameraPivot.getYAxis() )
.normalize();
camera.setOrientation( look, up );
camera.setPosition( cameraSatellite.getTransformedCenter() );
}
Make Mario a child of the camera Pivot:
cameraPivot.addChild( marioObject3D );
When changing Mario's position, move the cameraPivot (causes both Mario and the cameraSatelite to move):
cameraPivot.translate( someSimpleVector );
resetCameraPosition();
When rotating Mario around the X-axis or Z-axis (or whatever axis you want only Mario but not the cameraSatelite to rotate around), call rotate methods for marioObject3D:
marioObject3D.rotateX( someAngle );
But when rotating Mario around the Y-axis (or whatever axis you want both Mario and the cameraSatelite to rotate around), rotate the cameraPivot instead:
cameraPivot.rotateY( someAngle );
resetCameraPosition();
To "zoom in", move the cameraSatelite closer to the cameraPivot:
SimpleVector direction = cameraPivot.getTransformedCenter().calcSub( cameraSatelite.getTransformedCenter() ).normalize();
direction.scalarMul( someValue ); // how 'fast' to zoom (negative to "zoom out")
cameraSatelite.translate( direction );
Oh, and one more thing, if you also want to be able to rotate the camera seperately from Mario, you could create a "masterPivot", which both the cameraPivot and marioObject3D are a child of. That way translating/rotating masterPivot affects both Mario and the Camera, while translating/rotating cameraPivot only affects the Camera.