Sign in to follow this  
CRACK123

translation a model in directx

Recommended Posts

CRACK123    235
Hi, I am trying to translate a model in Directx. I am not sure if I am doing it the right way. The following code is what I am using
// get the world transform - multiply it with the current transform
	// and then set the new transform
	D3DXMATRIX transform, invTransform, invTranspose;
	device->GetTransform(D3DTS_WORLD, &transform);
	D3DXMatrixInverse(&invTransform, NULL, &transform);
	D3DXMatrixTranspose(&invTranspose, &invTransform);
	
	D3DXVec3TransformNormal(&m_Position, &m_Position, &invTranspose);

	D3DXMatrixTranslation(&transform, m_Position.x, m_Position.y, m_Position.z);
	device->SetTransform(D3DTS_WORLD, &(transform * invTransform));

Is this the correct way to do it ? Or do I just have to create a translation matrix and do device->SetTransform(D3DTS_WORLD, &transMatrix); Thanks

Share this post


Link to post
Share on other sites

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