Here is some working code for rotating the view. The only thing is that it
is inverted. ie. moving left -> rotates right.


        ViewPlatform vp = new ViewPlatform();

        BranchGroup vpRoot = new BranchGroup();

        Transform3D vpTx = new Transform3D();
        vpTx.set(new Vector3f(0.0f, 1.0f, 0.0f));
        TransformGroup vpTxg = new TransformGroup(vpTx);
*       vpTxg.setCapability(TransformGroup.ALLOW_TRANSFORM_WRITE);
*       vpTxg.setCapability(TransformGroup.ALLOW_TRANSFORM_READ);
        MouseRotate mr = new MouseRotate(vpTxg);
        mr.setSchedulingBounds(new BoundingSphere(new Point3d(0,0,0), 100));
        vpTxg.addChild(mr);
        vpTxg.addChild(vp);
        vpRoot.addChild(vpTxg);

        view.attachViewPlatform(vp);
        locale.addBranchGraph(vpRoot);

Gj

> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of The
> Casteels
> Sent: Wednesday, 23 December 1998 3:54
> To: [EMAIL PROTECTED]
> Subject: [java3d] Need Simple Mouse Navigation Example
>
>
> Can someone please point me to a simple example of how to set up mouse
> navigation in a virtual world? I've tried everything I can think of and
> am still missing something.
>
> My program [snips below]  compiles and runs, but the mouse doesn't do
> anything.
>
> (I'll be cutting the program down to it's simplest form to work this out
> and will post it in its entirety if needed)
>
>
> //---------In the root program--------------------------------------
> public class NewWorld001 extends Applet implements ActionListener
>  {
>  TransformGroup moveView = new TransformGroup();
>
> //---------Here's what's in the objectGraph BranchGroup:----------
>
>   // Create the bounding leaf node
>   BoundingSphere bounds = new BoundingSphere(new Point3d(0.0,0.0,0.0),
> 100.0);
>   BoundingLeaf boundingLeaf = new BoundingLeaf(bounds);
>   objScale.addChild(boundingLeaf);
>
>   // Create the drag behavior node
>   MouseRotate behavior = new MouseRotate();
>   behavior.setTransformGroup(moveView);
>   moveView.addChild(behavior);
>   behavior.setSchedulingBounds(bounds);
>
>   // Create the zoom behavior node
>   MouseZoom behavior2 = new MouseZoom();
>   behavior2.setTransformGroup(moveView);
>   moveView.addChild(behavior2);
>   behavior2.setSchedulingBounds(bounds);
>
>   // Create the translate behavior node
>   MouseTranslate behavior3 = new MouseTranslate();
>   behavior3.setTransformGroup(moveView);
>   moveView.addChild(behavior3);
>   behavior3.setSchedulingBounds(bounds);
>
> //----------Under Public void
> init()--------------------------------------
>
>   u.getViewingPlatform().setNominalViewingTransform();
>   u.addBranchGraph(scene);
>
>   TransformGroup t = u.getViewingPlatform().getViewPlatformTransform();
>
>   Transform3D trans = new Transform3D();
>   t.getTransform(trans);
>
>   Transform3D holder2 = new Transform3D();
>   moveView.getTransform(holder2);
>
>   t.setTransform(holder2);
>
>
> =====================================================================
> To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
> Java 3D Home Page: http://java.sun.com/products/java-media/3D/
>

=====================================================================
To subscribe/unsubscribe, send mail to [EMAIL PROTECTED]
Java 3D Home Page: http://java.sun.com/products/java-media/3D/

Reply via email to