Sign in to follow this  

Model Following camera fps issue

This topic is 2831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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);

}

Share this post


Link to post
Share on other sites

This topic is 2831 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this