Hello,

I need help rotating a sphere around a models axis I’m totally lost on how to accomplish this.

Let me explain what I am trying to do:

I have a model with its own m_xpos, m_ypos, m_zpos to keep track of where it is and to move the model I use glTranslatef( m_xpos, m_ypos, m_zpos ); and to rotate it I send the angle and what to rotate by to glRotatef(m_xrot, 1.0f. 0.0f, 0.0f); glRotatef(m_yrot, 0.0f. 1.0f, 0.0f); glRotatef(m_zrot, 0.0f. 0.0f, 1.0f);

I have created spheres for collision detection and this is my problem.

If I want to move the sphere with the model all I have to do is use the models m_xpos, m_ypos, m_zpos + sheres m_Xoffset, m_Yoffset, m_Zoffset this moves the sphere everywhere the model goes and keeps it in intended location. ex: a sphere on the models hand will stays on the models hand everywhere I move it. Now here is where I am lost when I rotate the model using glRotatef() how do I get the sphere to rotate according to the models rotations and keep their offsets so the spheres will stay where I placed them on the model no matter how I rotate the model??? The spheres are not models themselves just mathematical representations in 3d space but I don’t know how to accomplish this and this is the last bit of info I need so I can have collision detection in my game.

Can anyone please help me on this I would greatly appreciate it.

Thanks.