Model Following camera fps issue

Started by
-1 comments, last by Richy321 14 years, 1 month ago
So I have a gun/hands model that I'm trying to make follow the camera in a standard fps style. (c++ / directx) I do some transforms in hud initialisation to get the model all lining up with my camera. I thought the best way would be to multiply the models transforms by the inverse view matrix then it would apply the same translations and rotations to the model. When I inverse the view I seem to lose the scaling information, if I don't inverse its all backwards. Reapplying the scaling doesn't work. How is this done? I suspect I'm going the wrong way about it or I need to do some form of manual matrix manipulation.

void CHud::update(float elapsedTime)
{
	//change health pics, weapon icons ect.

	D3DXMATRIX viewMatrix;
	m_device->GetTransform(D3DTS_VIEW,&viewMatrix);
	D3DXMatrixInverse(&viewMatrix,NULL,&viewMatrix);

	D3DXMATRIX handsTransform = (*m_handsMesh->getTransform());
	handsTransform *= viewMatrix;

	m_handsMesh->FrameMove(elapsedTime, &handsTransform);

}

-RJ

This topic is closed to new replies.

Advertisement