rotations
The code below to rotate the earth and moon is still not working
The moon is spending about 90% of the time on the outside of the earth.
Here is my actual adjusted code:
I was wondering if it was valid to simply negate a rotation amount as below, also I am assuming the overloaded * can handle multiple matrix multiplications.
fEarthRotSun = m_fRotationCurrent/3;
fEarthRotSelf = m_fRotationCurrent;
fMoonRotSelf = m_fRotationCurrent/2;
fMoonRotEarth = m_fRotationCurrent/2;
D3DUtil_SetTranslateMatrix(T2, 0,0,3.0f);//earth orbit dist.
D3DUtil_SetTranslateMatrix(T1, 0,0,1.5f);//moon orbit dist.
D3DUtil_SetRotateYMatrix(R1, fMoonRotSelf);
D3DUtil_SetRotateYMatrix(R2, fMoonRotEarth);
D3DUtil_SetRotateYMatrix(R5,-fEarthRotSun);
D3DUtil_SetRotateYMatrix(R4, fEarthRotSelf);
D3DUtil_SetRotateYMatrix(R3, fEarthRotSun);
World = R1 * T1 * R2 * R5 * T2 * R3;
m_pd3dDevice->SetTransform(...,&World)
// Render moon
m_pd3dDevice->DrawPrimitive(...)
// The earth''s world matrix
World = R4 * T2 * R3;
m_pd3dDevice->SetTransform(...,&World);
// Render earth
m_pd3dDevice->DrawPrimitive(...);
I could probably come up with an answer for you if I could see the code and test the program.
- WitchLord
- WitchLord
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement