D3DXMATRIX matRot, matTrans;
D3DXMatrixRotationYawPitchRoll(&matRot, y, x, z);
D3DXVec3TransformCoord(&m_pos, &m_pos, &matRot);
// locks the camera to a distance
m_pos = m_pos - m_target;
D3DXVec3Normalize(&m_pos, &m_pos);
m_pos = m_pos * m_targetDistance;
proper rotation about a vector
hopefully this will be quick and painless...
I have 2 vectors one is a "target" and the other is a "position" what i want to do is to have the "position" rotate about the "target"...
I have my rotating working but i can only get is to rotate around (0,0,0) i know i some how need to incorporate the "target" im just not sure where / how
here is what i got / have...
If I follow what you're asking then rotations are always about an axis passing through the origin. If you want a rotation about an axis that doesn't pass through the origin then you need a translation so that a point on the axis is the origin, do the rotation then translate it back.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement