diff --git a/code/LWOAnimation.cpp b/code/LWOAnimation.cpp index 9e2079cc0..cf88588d3 100644 --- a/code/LWOAnimation.cpp +++ b/code/LWOAnimation.cpp @@ -567,10 +567,15 @@ void AnimResolver::ExtractAnimChannel(aiNodeAnim** out, unsigned int flags /*= 0 anim->mRotationKeys = new aiQuatKey[ anim->mNumRotationKeys = keys.size() ]; // convert heading, pitch, bank to quaternion + // mValue.x=Heading=Rot(Y), mValue.y=Pitch=Rot(X), mValue.z=Bank=Rot(Z) + // Lightwave's rotation order is ZXY + aiVector3D X(1.0,0.0,0.0); + aiVector3D Y(0.0,1.0,0.0); + aiVector3D Z(0.0,0.0,1.0); for (unsigned int i = 0; i < anim->mNumRotationKeys; ++i) { aiQuatKey& qk = anim->mRotationKeys[i]; qk.mTime = keys[i].mTime; - qk.mValue = aiQuaternion( -keys[i].mValue.x ,-keys[i].mValue.z ,-keys[i].mValue.y ); + qk.mValue = aiQuaternion(Y,keys[i].mValue.x)*aiQuaternion(X,keys[i].mValue.y)*aiQuaternion(Z,keys[i].mValue.z); } }