Jump to content
  • Advertisement

Archived

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

cwestbrook20

'Camera' Following a Character, but with free controls

This topic is 5437 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
Advertisement
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
Thats exactly how I want to do it, but I don''t know how to get it so the camera ''Zooms'' out as you move (to a point) then rubber band back to the normal distance. But I don''t know where to start for this...

Share this post


Link to post
Share on other sites
If you search the boards for "camera" there is a post where someone gave a link to a pretty good camera class for download. It was better than most tutorials I''ve seen online.

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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!