Fix converting rotations to quaternion.
This conversion must respect the LightWave ZXY rotation order.pull/3/head
parent
c3dad6a6b8
commit
32cabd8bbc
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue