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

Reply via email to