My solution to this problem was to create a method that updated the
TransformGroup associated with the ViewingPlatform (whereas the MouseRotate,
etc are generally applied to a geometry related transform).  In other words
I am moving my viewpoint around the geometry, rather than moving the
geometry in front of a stationary viewpoint.  I accomplished this using the
following code

        void UpdateViewTransform()
                {
                file://First we setup a transform for our default
(az=el=0.0) condition
                Transform3D t3d = new Transform3D();
                Point3d center = new Point3d(0.0,0.0,0.0);
                Point3d eye = new Point3d(zoomTrans,0.0,0.0);
                Vector3d up = new Vector3d(0.0,0.0,1.0);
                t3d.lookAt(eye, center, up);
                t3d.invert();

                file://Now create the az/el transform
                Transform3D viewT3D = new Transform3D();
                file://Note that the order of setEuler is roll,pitch,yaw
                viewT3D.setEuler(new Vector3d(0.0, -currentEl, currentAz));
                viewT3D.mul(t3d);

                file://Now do any panning transform
                t3d = new Transform3D();
                t3d.setTranslation(new Vector3d(panXTrans,panYTrans,0.0));
                viewT3D.mul(t3d);

                TransformGroup viewTG =
world.getViewingPlatform().getViewPlatformTransform();
                viewTG.setTransform(viewT3D);
                }

I modify the values of currentAz, currentEl, zoomTrans, and the
pan(XY)Trans, through callbacks from a modified MouseBehavior (modeled after
the MouseRotate,etc) method.  If you look at these methods you will observe
a MouseBehaviorCallback class.  I created my own similar interface which
includes GetCurrentAz, SetCurrentAz, GetCurrentEl, SetCurrentEl, Zoom, and
Pan.  In the MouseXxxx methods there are scale factors that determine the
amount of rotation,etc. for a given mouse movement.  I modify that value
each time I zoom so that when I am in close the rotate, pan, and zoom are
slower than when I am farther away.  Also note that in the above routine I
am using a left handed elevation (thus the negation of the elevation value).
I hope this helps.


John P. Williams
[EMAIL PROTECTED]
Voice 850.314.6700
Fax    850.314.7508

----- Original Message -----
From: Eric Reiss <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, May 14, 2000 11:41 PM
Subject: [JAVA3D] Mouse / picking behaviors and arbitrary views


> I was wondering if anyone knew of a better implementation of the picking
> and mouse behaviors than that provided by SUN for allowing objects to be
> translated, rotated and zoom from an arbitrary viewpoint other than one
> normal to the XY plane.
>
> When I move to a view that isn't normal to the XY plane and try to
> translate an object, horizontal and vertical mouse movements only move the
> object within the XY plane.  I want them to move the object in a plane
> represented by the view (this is the more intuitive approach).
>
> Rotations are fixed about the Y and X axis instead of arbitrary axis
formed
> by vertical and horizontal components of the view.
>
> Likewise, the Zoom is just along the Z axis instead of along a path normal
> to the arbitrary view.
>
> Any help would be greatly appreciated.
> ***********************************************************************
> Eric Reiss - http://www.sigda.acm.org/Eric/
> Email: [EMAIL PROTECTED]
>
> SIGDA Internet Server Manager - http://www.sigda.acm.org/
>
> Assistant Systems Manager - School of Engineering
> University of Pittsburgh
> ***********************************************************************
>
>
===========================================================================
> 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".
>
>

===========================================================================
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