Ady
2003-07-02 08:39:07 UTC
Animation in my app is based on keyframes. In a rotation key frame I
keep a quaternion value, when interpolating between rotation key
frames I do a slerp. When the last rotation keyframe is passed I would
like to give the user the option to continue the animation, to do this
I need to extrapolate a quaternion delta from the quaternions in the
last frame and the penultimate frame and add this rotation delta to
the objects current rotation ( quaternion multiply ). The way I am
extrapolating a rotation delta currently is:
D3DXQUATERNION to = pRotateToKeyFrame->GetRotation();
D3DXQUATERNION from = pRotateFromKeyFrame->GetRotation();
D3DXQUATERNION delta = ( ( to - from ) / float(
pRotateToKeyFrame->GetFrame() - pRotateFromKeyFrame->GetFrame() ) );
D3DXQuaternionNormalize( &delta, &delta );
But this is not giving the results I was expecting, not knowing too
much about quaternions I dont know if my approach is a little naive.
Any help would be great.
PS: The GetFrame call on the rotation keyframe returns the position of
that keyframe in the animation.
keep a quaternion value, when interpolating between rotation key
frames I do a slerp. When the last rotation keyframe is passed I would
like to give the user the option to continue the animation, to do this
I need to extrapolate a quaternion delta from the quaternions in the
last frame and the penultimate frame and add this rotation delta to
the objects current rotation ( quaternion multiply ). The way I am
extrapolating a rotation delta currently is:
D3DXQUATERNION to = pRotateToKeyFrame->GetRotation();
D3DXQUATERNION from = pRotateFromKeyFrame->GetRotation();
D3DXQUATERNION delta = ( ( to - from ) / float(
pRotateToKeyFrame->GetFrame() - pRotateFromKeyFrame->GetFrame() ) );
D3DXQuaternionNormalize( &delta, &delta );
But this is not giving the results I was expecting, not knowing too
much about quaternions I dont know if my approach is a little naive.
Any help would be great.
PS: The GetFrame call on the rotation keyframe returns the position of
that keyframe in the animation.