// 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));
translation a model in directx
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
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
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement