Why the animation controllers would want to flip my animation on bip001.....
See the figures below, I dumped at time 0 is different than the dump I get
from GetSRT on time zero...
//TRACE("anim ctrl bvh: " << pAnimCtrl); const float ntick = 500.0f; const UINT nKeyMax = 700; // all times for bone i const UINT nKeys = motionFrames; CComPtr<ID3DXKeyframedAnimationSet> pAnimSet; MeshXAnimResult result; int total_frames = motionFrames; float total_frame_time = frameTime * (float)(total_frames+1); float one_frame_time = frameTime; D3DXCreateKeyframedAnimationSet("Loiter", ntick, D3DXPLAY_ONCE, BONE_MAX, 0, NULL, &pAnimSet); Transform* l_transform = this->m_simObject->FindComponentByType<Transform>(); std::vector<std::vector<D3DXKEY_VECTOR3>> pScal; std::vector<std::vector<D3DXKEY_VECTOR3>> pTrans; std::vector<std::vector<D3DXKEY_QUATERNION>> pRot; pScal.resize(BONE_MAX); pTrans.resize(BONE_MAX); pRot.resize(BONE_MAX); for (int i = 0; i < pScal.size(); i++) { pScal[i].resize(nKeyMax); } for (int i = 0; i < pTrans.size(); i++) { pTrans[i].resize(nKeyMax); } for (int i = 0; i < pRot.size(); i++) { pRot[i].resize(nKeyMax); } UINT k = 0; for (float t = 0; t < total_frame_time; t += one_frame_time) { TRACE("t at :" << t); TRACE("......"); Vec3 sca[BONE_MAX], pos[BONE_MAX]; Quat rot[BONE_MAX]; // bvh data with offset to parent bone CopyOffsetMatrix(animationNumber, t); // bvh data with animation and orientation fixed (in combined matrices with no world) meshX->CalcAnimationFromBvhNoCombine(this, bind[1], t, sca, rot, pos, radius); for (FrameIterator it(meshX->m_frames); it.GetCurrent() >= 0; ++it) { BONE_ID id = it.GetCurrent(); const Frame& f = meshX->m_frames[id]; //TRACE("id of " << id << " is " << f.name); Quat r = rot[id]; Vec3 p = pos[id]; Vec3 s = sca[id]; //TRACE(f.name); //TRACE(s.x << " " << s.y << " " << s.z); //TRACE(p.x << " " << p.y << " " << p.z); //TRACE(r.x << " " << r.y << " " << r.z << " " << r.w); //TRACE("=======\n"); //D3DXMATRIX testM; //D3DXMatrixTransformation(&testM, NULL, NULL, &s, NULL, &r, &p); //TRACE("Wicked for " << f.name); //DumpMatrix(testM); //TRACE("=====\n\n"); // world //D3DXVECTOR3 boneSca, bonePos; //D3DXQUATERNION boneRot; //D3DXMatrixDecompose(&boneSca, &boneRot, &bonePos, &searchMat); //pTrans[id][k].Time = pAnimSet->GetSourceTicksPerSecond() * t; pTrans[id][k].Time = t; pTrans[id][k].Value = p; //pRot[id][k].Time = pAnimSet->GetSourceTicksPerSecond() * t; pRot[id][k].Time = t; pRot[id][k].Value = r; //pScal[id][k].Time = pAnimSet->GetSourceTicksPerSecond() * t; pScal[id][k].Time = t; pScal[id][k].Value = s; } k++; } for (FrameIterator it(meshX->m_frames); it.GetCurrent() >= 0; ++it) { BONE_ID id = it.GetCurrent(); const Frame& f = meshX->m_frames[id]; D3DXKEY_VECTOR3 posKeys[nKeyMax]; D3DXKEY_VECTOR3 scaKeys[nKeyMax]; D3DXKEY_QUATERNION rotKeys[nKeyMax]; for (int i = 0; i < nKeyMax; i++) { scaKeys[i] = pScal[id][i]; posKeys[i] = pTrans[id][i]; rotKeys[i] = pRot[id][i]; } //TRACE("id of " << id << " is " << f.name); // just give a name to the animation DWORD aInd; pAnimSet->RegisterAnimationSRTKeys(f.name, nKeys + 1, nKeys + 1, nKeys + 1, scaKeys, rotKeys, posKeys, &aInd); } UINT n = 0; pAnimSet->GetAnimationIndexByName("Bip001", &n); for (int i = 0; i < pAnimSet->GetNumAnimations(); i++) { if (i == n) { D3DXVECTOR3 pos, sca; D3DXQUATERNION rot; pAnimSet->GetSRT(0, i, &sca, &rot, &pos); D3DXMATRIX wicked; D3DXMatrixTransformation(&wicked, NULL, NULL, &sca, NULL, &rot, &pos); TRACE("Checking wicked..."); DumpMatrix(wicked); } } [code] t at :0 ...... Wicked for SceneRoot 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ===== Wicked for Operator 1 0 0 0 0 1 0 0 0 0 1 0 0 0 0 1 ===== Wicked for Bip001 1.19209e-006 0 -1 0 0 1 0 0 1 0 1.19209e-006 0 -0.000633966 1.9252 -0.033745 1 ===== Checking wicked... 1.19209e-006 0 1 0 0 1 0 0 -1 0 1.19209e-006 0 -0.000633966 1.9252 -0.033745 1