Sign in to follow this  

Camera Class + CameraPath

Recommended Posts

Hello, I have a little design question about my camera class and about camera paths. 1) Where should I handle the input of the user to move the camera? Should the camera handle the input itself or should the "application loop" handle the input and just call the appropriate methods of the camera? Currently I use the latter method and it looks like this:
void handleInput() { // this function is called from the application loop

So in my implementation the camera only knows how to move forward, backwards etc. and has no idea about keyboard input. Do you think this is ok? 2) I have a class Camera, which defines a free space-game like camera, and a class CameraPath, which handles a spline based path for a camera fly. Now I wonder how I should relate these two classes. I need the camera at a lot of places in my code (for example to get the eye point: Vec3 eye = camera->getEyePoint() etc.) so the camera definitely should be an independent object. Basically I have two ideas: A: My camera class HAS a camera path (as member). So setting up the camera path would look something like that:
Camera cam;

B: The class CameraPath has a register method to register a camera. If the camera moves along the path, the registered camera is updated:
CameraPath p;
Camera cam;

p.moveOnPath(t);  // now cam gets updated

What would you prefer? Or do you use other (better) approaches in your applications? Im looking forward for any ideas/suggestions:)

Share this post

Link to post
Share on other sites
Personally I like the idea of having the "registerCamera" function; it'd allow you to have any number of paths that can be processed in sequence. For example, have 10 different paths for a cutscene- it'd be a pain to have to use addPathPoint for all those different paths verse registering the camera on all the paths, then processing them in a timed sequence based on a script or w/e.

Just my two cents :)


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this