Archived

This topic is now archived and is closed to further replies.

'Camera' Following a Character, but with free controls

This topic is 5149 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am working on a Example where I want a ''Camera'' to follow a 3D Character(Human) around. The player should be able to rotate the ''Camera'' around manually, but the program should always fall back onto a (customized) setting where the camera follows the character. The View would be top down, almost the same angle as games like Warcraft III. This is in OpenGL, I am not using SDL yet(or glut). I can post some code if people want. Any good Camera Classes and how to impliment them in this application. Maybe even a good tutial (other then www.gametutorials.com)

Share this post


Link to post
Share on other sites
Best way i can think of doing it would be to fix the camera looking at the person and when the user creates some input do what they want.
Then, when you''ve not had any input for a while drift the camera back towards the character over time.

As for the practical side of doing it, cant really help there atm

Share this post


Link to post
Share on other sites
Here''s what I do in my orbital camera class to set up the modelview matrix:


glLoadIdentity();
glTranslatef(0,0,-radius);
glRotatef(rot[0],1,0,0);
glRotatef(rot[1],0,1,0);
glTranslatef(-pos[0],-pos[1],-pos[2]);

Should be pretty self-explanitory. Rot is the rotation about the x and y axis BTW.

Share this post


Link to post
Share on other sites