When you manipulate the view platform's transform, it's not the scene that
changes, it's the view. If by "same result"/"same behavior", you're seeking
the scene to change, I'm not sure how you would do that by manipulating the
view.
Otherwise, the code snippet below provided me with mouse navigation of
viewpoint, and worked as expected. (It's best viewed with a monowidth font.)
Bounds behaviorBounds = new BoundingSphere( new Point3d(), 2000.0 );
//======================================================================
// Create behaviors
// To allow navigation behaviors to be "always on", they use a
// BoundingLeaf rather than a Bounds. The BoundingLeaf allows the
// bounds to travel with the view rather than the content.
//
// <strong>Object model:</strong><p>
// <pre>
// -----------------------------------------------------------------------
// | : Graph
// |
// | newBehaviorParent this : GraphViewingPlatform
// | | |
// | | super.platformGeometry : BranchGroup
// | | |
// | m_bgNavBehavior m_bgNavBounds
// | | |
// | |* |*
// | :Behavior ...........> :BoundingLeaf
// -----------------------------------------------------------------------
// </pre>
//
// For more discussion on the use of BoundingLeaf with behaviors, see
// "Getting started with the Java3D API", by Dennis J. Bouvier for
// Sun Microsystems. An online version of the book so far is
// <a
href="http://java.sun.com/products/java-media/3D/collateral/">here</a>.
//
// <strong>INVERT_INPUT</strong><p>
// Reverse the direction of the mouse behavior so that it's
// appropriate for modifying the view platform transform.<p>
//======================================================================
boolean isVPTransform = ( null == newBehaviorTransform );
TransformGroup tg = (isVPTransform) ? this.getViewPlatformTransform()
: newBehaviorTransform;
boolean bRotate = ( 0 != (flags & NAVIGATE_ROTATE ));
boolean bTranslate = ( 0 != (flags & NAVIGATE_TRANSLATE));
boolean bZoom = ( 0 != (flags & NAVIGATE_ZOOM ));
//======================================================================
// Mouse rotation
//======================================================================
int mouseFlags = (isVPTransform ? MouseBehavior.INVERT_INPUT : 0);
if ( bRotate ) {
MouseBehavior behavior = new MouseRotate( mouseFlags );
behavior.setTransformGroup( tg );
m_bgNavBehavior.addChild( behavior );
BoundingLeaf boundingLeaf = new BoundingLeaf( behaviorBounds );
m_bgNavBounds.addChild( boundingLeaf );
behavior.setSchedulingBoundingLeaf( boundingLeaf );
}
if ( bTranslate ) {
MouseBehavior behavior = new MouseTranslate( mouseFlags );
behavior.setTransformGroup( tg );
m_bgNavBehavior.addChild( behavior );
BoundingLeaf boundingLeaf = new BoundingLeaf( behaviorBounds );
m_bgNavBounds.addChild( boundingLeaf );
behavior.setSchedulingBoundingLeaf( boundingLeaf );
}
if ( bZoom ) {
MouseBehavior behavior = new MouseZoom( mouseFlags );
behavior.setTransformGroup( tg );
m_bgNavBehavior.addChild( behavior );
BoundingLeaf boundingLeaf = new BoundingLeaf( behaviorBounds );
m_bgNavBounds.addChild( boundingLeaf );
behavior.setSchedulingBoundingLeaf( boundingLeaf );
}
-----Original Message-----
From: Victor Raymond <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED] <[EMAIL PROTECTED]>
Date: Friday, October 29, 1999 6:46 PM
Subject: [JAVA3D] MouseBehavior.INVERT_INPUTS
>Most of the Java3D example programs allow rotation of the scene by
>adding a MouseRotate which manipulates a top-level TransformGroup
>on the content side of the scenegraph
>
>I need to manipulate the View Platform's parent Transform
>(on the view side of the scenegraph) and achieve the same result.
>The Java3d documentation seems to suggest that all I'd have to
>do is use a MouseRotate constructed with the INVERT_INPUTS flag
>and have this manipulate the View Platform's Transform.
>
>This doesn't provide the same behavior.
>
>What should I be doing?
>
>Thanks.
>
>- Victor
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com
>
>===========================================================================
>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".