Well just set the world matrix like this:
D3DXMatrixRotationX(&matRotX, XAngle);D3DXMatrixRotationY(&matRotY, YAngle);D3DXMatrixRotationZ(&matRotZ, ZAngle);D3DXMatrixTranslation(&matTrans, 0.0f, 0.0f, 0.0f);D3DXMatrixIdentity(&matWorld);D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans);D3DXMatrixMultiply(&matWorld, &matWorld, &matRotZ);D3DXMatrixMultiply(&matWorld, &matWorld, &matRotY);D3DXMatrixMultiply(&matWorld, &matWorld, &matRotX);d3ddev->SetTransform(D3DTS_WORLD, &matWorld);
then draw the object and it will be at the origin.
Then set the world matrix like this:
D3DXMatrixRotationX(&matRotX, XAngle);D3DXMatrixRotationY(&matRotY, YAngle);D3DXMatrixRotationZ(&matRotZ, ZAngle);D3DXMatrixTranslation(&matTrans, 0.0f, 0.0f, 10.0f/*distance of wall behind object*/);D3DXMatrixIdentity(&matWorld);D3DXMatrixMultiply(&matWorld, &matWorld, &matTrans);D3DXMatrixMultiply(&matWorld, &matWorld, &matRotZ);D3DXMatrixMultiply(&matWorld, &matWorld, &matRotY);D3DXMatrixMultiply(&matWorld, &matWorld, &matRotX);d3ddev->SetTransform(D3DTS_WORLD, &matWorld);
and draw the wall. Make sure that your view is facing down the positive z axis. You could set it like this:
D3DXMatrixRotationX(&matRotX, -XAngle);D3DXMatrixRotationY(&matRotY, -YAngle);D3DXMatrixRotationZ(&matRotZ, -ZAngle);D3DXMatrixTranslation(&matTrans, 0.0f, 0.0f, 5.0f);D3DXMatrixIdentity(&matView);D3DXMatrixMultiply(&matView, &matView, &matTrans);D3DXMatrixMultiply(&matView, &matView, &matRotZ);D3DXMatrixMultiply(&matView, &matView, &matRotY);D3DXMatrixMultiply(&matView, &matView, &matRotX);d3ddev->SetTransform(D3DTS_VIEW, &matView);