Advanced 3rd Person Camera

Started by
11 comments, last by spencerholmes 18 years, 9 months ago
Ah well, That's easy. Find the nearest point on the curve, and if you cache from frame to frame the current position on the curve, then it should be cheap. Then use LERP to smooth it out.

To find the closest point on a curve, well, usually, I don't bother with perfect curves, and use a segmented approximation. Then it's only a matter of finding the segment the closest to where you want it to be, which is easy code (point to segment distance).

here is an example.

Everything is better with Metal.

Advertisement
I think you are misleading yourself by thinking you need to define a spline. What I think you want to do is done frequently in the Two Towers and ROTK games, and there are generally 2 modes:

1) Just pick some orientation and distance that the camera should sit relative to the player (in world space). As the player runs around, the camera keeps the same orientation and distance with hopefully some nice smooth damped motion.

2) Pick some pivot point off in the distance, and wherever the player runs, keep the camera locked in line with the player and the pivot point. This makes the camera always trained on some "important" spot no matter where the player goes. Again, nice smooth motion is a good idea.

Another thing you can do is to not have the player be in the dead center of the screen, and instead have the camera look slightly in whichever direction the player is facing. Presumably, the player is facing the action, so it's an aid to the camera to have more of what the player is interested in on the screen.

Another tricky part is transitioning between 2 different camera modes. You need to make it happen quickly but not be too jerky. This can be very difficult. I feel I should emphasize that smooth motion is important :)

Why don't you use basic waypointing to control the movement of the camera then you can get it to move along the path at the same speed as the character and at the right places.

This topic is closed to new replies.

Advertisement