I have my CUBE.x loaded into LPD3DXMESH object. Are there specific flags I can set for the entire object
Like I want to translate/rotate/scale just this object in the view of my camera. I don't want these changes to affect any of my other loaded models.
Are there local axises that I can alter

Does LPD3DXMESH have built in values I can adjust manually?
Jos Verlinde
Well heres the thing I want to translate my cube according to x,y values along the world axises. Does the D3DXMatrixTranslation do what I want
Greg Van Mullem
The meshes itself doesn’t contain build in values for this. If you want to translate/scale or rotate them you have to build a matrix for this operation (Direct3DX contains helper for this) and use it as part of your transformation. If you use the fixed function pipeline you have to set it as world matrix. The shader pipeline needs it as constant on the right registers.
Boman
I actually have my code configured now. The problem I am having now is that my object rotates around the center of the world axis Y instead of the objects axis. I guess my quesition now would be do i rotate and then translate or translate then rotate my cube..
Asiye
Ok so I have my device.
LPDIRECT3DDEVICE9 pDevice;
I also have my Mesh object:
LPD3DXMESH oglla;
THen my matrix .
D3DXMATRIX pTheWorld;
1st:
I load my mesh into the device.
if
FAILED(D3DXLoadMeshFromX("MYCUBE.x", D3DXMESH_SYSTEMMEM, pDevice, NULL, &mymodel1, NULL, &dnumofMats, &oglla)){
MessageBox(hWnd, "D3DXLoadMeshFromX", "Failed to Load", MB_OK);
}
2nd
pDevice->SetTransform(D3DTS_WORLD, &pTheWorld);
then what
FreeHansje
You need to associate the device with your matrix before you call DrawSubset for the mesh
pDevice->SetTransform (D3DTS_WORLD, pTheWorld);
oglla-> DrawSubset (0);
Sandrix
Well, actually things are the same for multiple models scene, D3DXMatrixTranslation here is really useful
Try this code (it looks very familiar, doesn't it
)
static float DistanceZ=1.0;
D3DXMATRIXA16 mWorld;
D3DXMATRIXA16 mTrans;
D3DXMatrixTranslation(&mTrans, 0, 0, DistanceZ);
DistanceZ+=0.05;//try to change this value
mWorld=mWorld*mTrans;
pDevice->SetTransform( D3DTS_WORLD, &mWorld );
// here goes model #1 drawing part
//DrawSubset..............
// Here we set the matrices to Identity, that is containing zeroes everywhere but in the main diagonal to previous values not to affect the second model transformations:
D3DXMatrixIdentity(&mWorld);
D3DXMatrixIdentity(&mTrans);
D3DXMatrixTranslation(&mTrans, 0.5, 0, 1.0);
mWorld=mWorld*mTrans;
pDevice->SetTransform( D3DTS_WORLD, &mWorld );
// here goes model #2 drawing part
//DrawSubset..............
robinjam
Have you already take a look in the 6 tutorial examples in the SDK The 6th one shows what you want to do.
SQuen
How do I associate my mesh with the matrix
LPD3DXMESH oglla;
D3DXMATRIX pTheWorld;
Basically I want my mesh to be loaded into the matrix and then transform the matrix according the what my input values are.
Talkless
Actually, I tried to answer your question at the beginning of the thread...
As for your last one, use this: mWorld=mRotateY*mTrans, that is , rotate first, then translate. Was it hard to try it yourself