Hello Scouting Ninja and Mike,
Maybe I look into the rig thing later, but now my "customized" animation looks quite good... the only one thing is I can't really name or tag a key...
For example, the moveback animation set comes from an animation factory, there are 4 keys, at
0,0,0 -> -2,0,0 -> -2,0,0 -> -2,0,-2
no rot->no rot-> turn 1.57->turn 1.57
Notice it's a relative animation set, so it is relative to the origin.
The problem with this now it is turning right, how do I make it turn left
You can negate the rotations, and also negate the translations, despite of the first key...
Without naming it, I can't really tell
if (pAnimSet)
{
Transform* l_transform = FindComponentByType<Transform>();
DOUBLE pCurTime = m_pAnimController->GetTime();
DOUBLE pPeriodPos = m_pMoveBack->GetPeriodicPosition(pCurTime);
D3DXVECTOR3 s, p;
D3DXQUATERNION r;
pAnimSet->GetSRT(pPeriodPos, 0, &s, &r, &p);
p *= 0.5f;
//TRACE("Trans is " << p.x << " " << p.y << " " << p.z);
D3DXMATRIX matTrans;
D3DXMatrixTranslation(&matTrans, p.x, p.y, p.z);
D3DXMATRIX matRot;
D3DXMatrixRotationQuaternion(&matRot, &r);
// Now we have a world matrix done
// And we add onto the matrix
D3DXMATRIX matFinal;
matFinal = matRot;
D3DXMATRIX* l_pWorld = l_transform->getWorldMatrixPtr();
matFinal *= *l_pWorld;
matFinal *= matTrans;
*l_pWorld = matFinal;
}