I have created a simple application where there is a polygonal plane drawn against a light blue background. At the click of a button I want to be able to make the polygonal plane perpendicularly seen. How can I rotate the entire view? There could be other objects in the scene which need to maintain their same positions on the rotation.
Could anyone please help?
The view of the camera is pointing down (-Z axis)
You must rotate the camera 90 degrees around the X axis (or Y) to guide the eye to the horizon.
// PASS 1 - Get Transform3D the universe
Transform3D lOb_Transform3D_Universe = new Transform3D( );
TransformGroup cOb_TransformGroupUniverse = TheObject_SimpleUniverse.getViewingPlatform( ).getViewPlatformTransform( );
cOb_TransformGroupUniverse.getTransform( lOb_Transform3D_Universe );
// PASS 2 - Rotate the view 90 degrees on axis X
lOb_Transform3D_Universe.rotX( Math.toRadians( ( double ) 90.00 ) );
// PASS 3 - Update the rotation of the universe
cOb_TransformGroupUniverse.setTransform( lOb_Transform3D_Universe );
Now the camera is looking at the horizon with a height of 0. Remember also to raise the height !!!
- Finish ! -