[font=arial, sans-serif]
[font=arial, sans-serif]just something weird is happening
[font=arial, sans-serif]when the cursor approaches the player, the arm moves strangely, see:
[font=arial, sans-serif][media]
Whew! Glad you have it at least partially working
Are you sure you're converting the mouse point to client coordinates correctly?
GetCursorPos(&absCursor);
ScreenToClient(wndHandle,&absCursor);
D3DXVECTOR3 mouseLocation((float)absCursor.x,(float)absCursor.y,0);
player->mouselocal(mouseLocation, WIDTH, pm, vm,vp);
void mouselocal(D3DXVECTOR3 pos_of_Mouse, int Width, D3DXMATRIX pm, D3DXMATRIX vm, D3DVIEWPORT9 vp);
Are you using exactly the same world matrix in the D3DXVec3Project call that you use to render the object?
class SKINNEDMESH
{
public:
SKINNEDMESH();
~SKINNEDMESH();
//...
//...
private:
//...
//...
// Setup world matrix
D3DXMATRIXA16 matWorld,matWorld2;
//...
//...
};
//...
//...
D3DXMatrixTranslation( &matWorld2, vPos.x, vPos.y,vPos.z );
D3DXMatrixMultiply(&matWorld,&matWorld,&matWorld2);
m_pDevice->SetTransform( D3DTS_WORLD, &matWorld );
//If there is a mesh to render...
if(bone->pMeshContainer != NULL)
{
BONEMESH *boneMesh = (BONEMESH*)bone->pMeshContainer;
//...
//...
D3DXMATRIX final = bone->TransformationMatrix*(*parentMatrix);
D3DXVECTOR3 boneLocation(final._41,final._42,final._43);
D3DXVec3Project(&boneLocation,&boneLocation,&m_vp,&m_pm,&m_vm,&matWorld);
player->mouselocal(mouseLocation, WIDTH, pm, vm, vp);
player->mouselocal(mouseLocation, WIDTH, pm, vm, vp);
I don't know what that function does, but you don't need to do anything with mouseLocation after you convert it to client coordinates!
Comment out that line and try it.
void SKINNEDMESH::mouselocal(D3DXVECTOR3 pos, int Width, D3DXMATRIX pm, D3DXMATRIX vm, D3DVIEWPORT9 vp)
{
mouseLocation = pos;
m_Width = Width;
m_pm = pm;
m_vm = vm;
m_vp = vp;
}