Skip to main content
GameDev.net gamedev.net
🔒 Locked

Camera Delay?

Started by MetaKnight Jun 11, 2002 at 11:40 PM 0 replies 250+ views
Original Post
MetaKnight
MetaKnight
Can anyone help me out on how to make a camera delay into positioning itself into position behind the player. i got the camera position and the player position and the direction the player is looking it
Dirge
Dirge
For a delay, the classic (cheap) approach is just to keep a list (array) of all the positions a camera to go to be at a final position.

So you have CameraBegin - The beginning camera position, and CameraEnd.

You can Linearly Interpolate the values of CameraBegin and CameraEnd to get the in between frames.
So:
(1.0f - PercentComplete) * CameraBegin + CameraEnd * PercentComplete;

Now you could just use a step value, say 0.2f, that goes into 1.0f (the max percent complete value) 5 times. This gives you 5 entrys into your array.

Then you slowely go through the array at say 10 frames a second:
CameraCurrentFrame += 10 * fTimeElapsed;

This would make that array be done in half a second, so you''d want it to be much bigger, but I think you get the idea.


So thats one of the techniques you could use. There''s at least a few dozen more with a few different kinds of camera interpolation to help out (LERP''s kinda suck). If you need help actually orienting the camera, just ask. Shouldn''t be tough though.
"Artificial Intelligence: the art of making computers that behave like the ones in movies."www.CodeFortress.com

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.