Hy.
I've got a object with his matrix.
Now i would to rotate it on the X,Y or Z axes, but the object is not on that axes. So, knowing this trasformation:
D3DXMatrixTranslation(&Alien.MeshData.ColladaBuffer.Objmatr,15.0f,-30.0f,25.0f);
D3DXMatrixScaling(&p,0.6f,0.6f,0.6f);
D3DXMatrixMultiply(&Alien.MeshData.ColladaBuffer.Objmatr,&Alien.MeshData.ColladaBuffer.Objmatr,&p);
D3DXMatrixRotationX(&p,-1.3f);
D3DXMatrixMultiply(&Alien.MeshData.ColladaBuffer.Objmatr,&Alien.MeshData.ColladaBuffer.Objmatr,&p);
I tried to rotate it in this way
D3DXMATRIXA16 m,p,q,r;
D3DXMatrixTranslation(&q,15.0f,-30.0f,25.0f);
D3DXMatrixRotationZ(&r,-1.3f);
D3DXMatrixInverse(&m,NULL,&q);
D3DXMatrixRotationY(&p,f);
Alien.MeshData.ColladaBuffer.Objmatr = m * p * r * q;
f+=0.0001f;
But it does not give me the wishered result.
If i remove the r multiplication, it rotates correctly, but it's not centred.
Here is an image
http://img213.imageshack.us/img213/1629/imghu3.jpg
I should say that i do not know if the object, in it's starting position, it's in 0,0,0 point. Anyway...
Can you give me an help?