Hi,
I am writing a game in C++ and OpenGL. My whole environment is based on cubes so I guessed bounding box collisions were best. I can currently move around and my program is detecting collisions (I used this tutorial: http://www.3dcodingtutorial.com/Collision-Detection/Collision-Boxes.html). Now I want to make it so that when the camera hits a bounding box it slides along it (like in any FPS game).
My update camera procedure looks like this:
void updateCamera()
{
glRotatef(xrot,1.0,0.0,0.0); //rotate the camera on the x-axis (left and right)
glRotatef(yrot,0.0,1.0,0.0); //rotate the camera on the y-axis (up and down)
glTranslated(-xpos,-ypos,-zpos); //translate the screen to the position of the camera
}
Thanks,
James