The problem could be due to rotational shearing affects, although it looks like Java3D normalizes the matrix when getting and setting the rotation values. I would try normalizing the interpolated quaternion before setting the matrix and see if that helps:
> data.position().get( mSrcOrientation ); > mLocData.position().get( mDstOrientation ); > mDstOrientation.interpolate( mSrcOrientation, dt / mTime ); -----> mDstOrientation.normalize(); > > data.position().setRotation( mDstOrientation ); As far as I know, the best way (in terms of results and efficiency) to interpolate between orientations is using quaternions. Is there any reason you are converting from matrices to quaternions (could you remove the use of matrices in this algorithm)? It seems like a good rule to try and minimize the number of data conversions in one's application. Quaternions have a very efficient representation (only four values to represent a rotation) and have the property that when a unit quaternion is multiplied (and interpolated as well I believe) with another unit quaternion, the result is a unit quaternion (a non-unit quaternion has shearing values). There are several good references on the web on quaternion math that you might want to look at. Sean > -----Original Message----- > From: Joerg 'Herkules' Plewe [mailto:[EMAIL PROTECTED] > Sent: Monday, February 24, 2003 9:23 AM > To: [EMAIL PROTECTED] > Subject: [JAVA3D] Using Quat4f correctly > > > Hi community! > > I've been failing to use Quat4f in a robust manner now > several times. I just > want to do an interpolation of orientation. Most of the time, > the results > seem to be OK, but sometimes using > Matrix4f#setRotation(Quat4f) leads to > totally distorted results. > > I suppose it has to do with my not-so-good understanding of > quaternion math. > But how do I have to setup quaternion solutions that deliver > a rocksolid > result? Where's my mistake? > > Are there better ways to do so? Interpolate an axisangle? Somehow? > > > Here is the code I use e.g. > > private final Quat4f mSrcOrientation = > new Quat4f(); > private final Quat4f mDstOrientation = > new Quat4f(); > > .... > > data.position().get( mSrcOrientation ); > mLocData.position().get( mDstOrientation ); > mDstOrientation.interpolate( mSrcOrientation, dt / mTime ); > > data.position().setRotation( mDstOrientation ); > > ============================================================== > ============= > 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".
