Jump to content
  • Advertisement
Sign in to follow this  
CRACK123

translation a model in directx

This topic is 3799 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

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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!