Hi, I wonder if anyone can help me. I’m writing a game that involves zooming in and out of a 3D star system with the zooming initialy centred at the star in the centre. You can then click on a planet to move the centre of zooming to the planet. The problem is that I also need to be able to change the centre of rotation to the new planet as well. This is the type of code I am using…
switch (m_nCameraPos)
{
case 1:
gluLookAt( -glPos[0], glPos[1], -m_dZoom,
-glPos[0], glPos[1], glPos[2],
0.0f, 1.0f, 0.0f);
if (m_dZoom > 0)
{
glRotatef(-yRot, 1.0f, 0.0f, 0.0f);
}
else
{
glRotatef( yRot, 1.0f, 0.0f, 0.0f);
}
glRotatef( xRot, 0.0f, 1.0f, 0.0f);
break;
case 2…
}// Draw the grid
auxWireCube(fGridSize*2.0);glDrawSectStars(galaxy, nSect, fGridSize);
Thanks for your help
Jamie