Hello again, Grace!

At 22:44 01.08.00 -0700, you wrote:
>I use simple universe, I put a few boxes vertically lining up, however some
>boxes are missing. When I resize the frame, more boxes are missing. I was
>told that we can more the viewer back or look down, I don't know how to do
>it except simpleUniverse. Could you show me the code or the place to find
>the code?

There's a convenience method available which makes it easy, once you
figure out how to get a hold of the right object and method. Here is a recipe:

// Set up your universe
     SimpleUniverse myUniverse = ...
...
// Get a hold of its ViewingPlatform
     ViewingPlatform viewingP = myUniverse.getViewingPlatform();

// Get a hold of the ViewingPlatform's MultiTransformGroup.
// This is the group of transforms between the viewing platform and the scene.
// For a simpleUniverse, there's just one Transform in the group.
     MultiTransformGroup mtg = viewingP.getMultiTransformGroup();

// Get the topmost TransformGroup from the Multi
     TransformGroup tg = mtg.getTransformGroup(0);

// Anytime you want to change your viewpoint, all you need to do is set a
// different Transform3D into this TransformGroup (tg). I wouldn't know how
// to set up the Transform3D for this purpose if it weren't for the handy
// convenience method they provide. All you have to do is figure out where
// you want your eye to be (I think setNominalViewingTransform() puts it at
// (0, 1.5, 2.41)) and where you want it to look at (a good place to start is
// the origin (0, 0, 0)) and do the following magic:
     Transform3D trans = new Transform3D();
     Point3d eye = new Point3d(0, 1.5, 5); // for example; this is 5 units back
     Point3d focus = new Point3d(0, 0, 0); // looking at origin
     Vector3d up = new Vector3d(0, 1, 0); // a vector pointing up
     trans.lookAt(eye, focus, up);
     trans.invert();
     tg.setTransform(trans);

Without my comments, it's really not all that long. Enjoy!

-Carl-

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to