Sign in to follow this  

Camera Class + CameraPath

This topic is 3095 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

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
if(DXUTIsKeyDown('W'))
    g_camera->moveForward(fElapsedTime);


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;
...
cam.addPathPoint(p1);
cam.addPathPoint(p2);
...
cam.moveOnPath(t);

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.addPathPoint(p1);
p.addPathPoint(p2);
p.registerCamera(&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 :)


-Nate

Share this post


Link to post
Share on other sites

This topic is 3095 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.

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