Hi Anthony,

I got a feeling that you should be using 3
TransformGroups when doing the rotations:

 transformX.rotX(x_angle);
 transformY.rotY(y_angle);
 modelTrans.mul(transformX, modelTrans);
 modelTrans.mul(transformY, modelTrans);

 transformGroup.setTransform(modelTrans);

Which then updates the actual 'transformGroup'

The above snip is from the java3d demo app FourByFour
-PickDragBehavior class file.

HTH,
Greg.

--- Anthony Arobone <[EMAIL PROTECTED]> wrote:
> Hi all,
>     I'm trying to do some rotation and translations
> with one TransformGroup object.  First I rotate
> around the Y ( to give yaw ), then I want to rotate
> around the new local Z ( to give roll ).  But the
> rotate around the Z is rotating around the original
> Z not the newly create Z.  I know this is how it is
> supposed to act, but I can't figure out how to get
> my rotation done on the local coord Z instead of the
> original.  Here is a snip of code:
>
>    // Save position before move
>    mTransformGroup.getTransform( mTranslate );
>    mTranslate.get( mLastPosition );
>
>    // Do yaw rotation
>    mDeltaRadiansY = <calc new delta radians to
> rotate by>;
>    mRotate.rotY( mDeltaRadiansY );
>    mTranslate.mul( mRotate );
>
>    // Do roll rotation
>    if ( (mDeltaRadiansZ != 0) ) {
>     mDeltaRadiansZ = -mDeltaRadiansZ * 0.19;
>     mRotate.rotZ( mDeltaRadiansZ );
>     mTranslate.mul( mRotate );
>     mDeltaRadiansZ = 0;
>    }
>
>    // Set delta point and transform
>    mDeltaVector.set( 0, 0, mDeltaTranslate );
>    mTranslate.transform( mDeltaVector );
>
>    <calc new mDeltaVector from collision detection>
>
>    // Change actual object
>    mLastPosition.add( mDeltaVector );
>    mTranslate.setTranslation(mLastPosition);
>    mTranslate.normalize();
>    mTransformGroup.setTransform(mTranslate);
>
>
> Thanks All,
> Anthony


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus - Powerful. Affordable. Sign up now.
http://mailplus.yahoo.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".

Reply via email to