I have a problem with some code I have made, I have made a d3d hook that basically changes some stuff up for me.
(NOW, so people don't think I'm creating a cheat, I am not, actually it's a hook for a private server for a MMO).
What I am trying to accomplish is to load a model at specific coordinates in the game.
My code is the following:
LPD3DXMESH mesh;
LPD3DXBUFFER materialBuffer;
DWORD numMaterials;
D3DXMATERIAL* d3dxMaterials;
D3DMATERIAL9 *meshMaterials;
LPDIRECT3DTEXTURE9 *meshTextures;
HRESULT hr=D3DXLoadMeshFromXA("arrow.x", D3DXMESH_DONOTCLIP,
pDevice, NULL,
&materialBuffer,NULL, &numMaterials,
&mesh );
d3dxMaterials = (D3DXMATERIAL*)materialBuffer->GetBufferPointer();
meshMaterials = new D3DMATERIAL9[numMaterials];
meshTextures = new LPDIRECT3DTEXTURE9[numMaterials];
for (DWORD i=0; i<numMaterials; i++)
{
// Copy the material
meshMaterials[i] = d3dxMaterials[i].MatD3D;
// Set the ambient color for the material (D3DX does not do this)
meshMaterials[i].Ambient = meshMaterials[i].Diffuse;
// Create the texture if it exists - it may not
meshTextures[i] = NULL;
if (d3dxMaterials[i].pTextureFilename)
D3DXCreateTextureFromFileA(pDevice, d3dxMaterials[i].pTextureFilename, &meshTextures[i]);
}
for (DWORD i=0; i<numMaterials; i++)
{
// Set the material and texture for this subset
pDevice->SetMaterial(&meshMaterials[i]);
pDevice->SetTexture(0,meshTextures[i]);
// Draw the mesh subset
mesh->DrawSubset( i );
}
D3DXMATRIX matIdt,RotY,Mov;
D3DXMatrixTranslation(&Mov,5000.0f, 0.0f, 20.5f);
D3DXMatrixRotationY(&RotY,350);
D3DXMatrixMultiply(&matIdt,&RotY,&Mov);
pDevice->SetTransform(D3DTS_WORLD,&matIdt);
Now, the result looks like this:

As you can tell, it gets attached to the arm of the character, and no matter what coordinates I put in Mov, it doesn't change a bit.
Now, I havent worked with matrixes in this way before, so I am not sure if I am doing this correct, only been working with graphics engines directly that had functions that let you set the coordinates of a specific model.
It seems as it's attaching the model to the joint of the characters arm for some reason, even though I did not specify that. Any ideas?

New Topic/Question
Reply



MultiQuote





|