Hello,
There's a trick in 3D to have full control over the camera: You need a
target and a parent (also called handle). The target is a point in 3D
space where the camera looks at and the handle allows you to move the
camera around the 3D scene but more importantly rotate it around any
axis while keeping its transformation. I would usually do this:
// The handle
var _cameraHandle:ObjectContainer3D = new ObjectContainer3D;
// The target
var _cameraTarget:ObjectContainer3D = new ObjectContainer3D;
// The camera
var camera:Camera3D = new Camera3D;
cameraHandle.addChild( camera );
// This 3 piece rig will allow for endless options in animating the
camera's movements!
// You can now add the camera to the scene as usual, and in the render
loop update the camera target and animate the camera's handle
// You can apply tweens to the target, the handle and the camera
independently for smooth motion
// I would use the handle for rotations and the camera for moving
along x, y and z.
// For example orbting with a radius of 1000
camera.z = -1000;
// This would be the onEnterFrame event where you handle the 3D render
call
private function enterFrameHandler ( event : Event ) : void
{
_cameraHandle.yaw(1);
camera.lookAt( _cameraTarget.position );
render();
}
In a planetarium setup you could move the target and handle to the
planet's position. Update the camera's z to the radius of orbit you
want. Rotating the handle to follow the mouse (hover around its
center). The beauty of this is that by offsetting the position of the
target you can frame the shot in different ways for nice cinematic
effects!
Hope this makes sense!
Cheers,
Jerome.