# #StackBounty: #unity #c# #camera #curves #third-person-view Third Person Camera Splines

### Bounty: 100

I’m having trouble coming up with a formula/method of creating third person camera with a variable distance from the player given a specific camera pitch.

This image shows something close to my desired result:

I basically only have two requirements. The camera has to be directly calculated from a pitch. The camera should roughly follow a smooth curve between the minimum and maximum camera distance and the halfway point is around 50% of the distance (as seen by the graph in the top right of the image).

So, Option A:

I create a function online to convert a pitch directly to a camera distance and use that. http://www.timotheegroleau.com/Flash/experiments/easing_function_generator.htm

I have this working and it ends up looking close but has two distinct problems. It is rigid and doesn’t allow me to edit any of the offsets or distances without having to create a whole new function and the camera at 0 degrees pitch ends up being around 15-30% of the maximum distance which doesn’t feel as good as if it were closer to 50%.

Option B:

Come up with a spline, perhaps a cubic bezier, between the min and max distances and somehow project the camera on to that spline given a specific pitch. I’m not sure how I would be able to do this. The disadvantages would be that the camera distance curve would not be as smooth without some tweaking and again it would require more work if any of the distances or offsets change.

Option C:

Come up with a specific formula which I have no idea how to find. Given the min and max camera distances, the offsets, and the camera pitch, return a distance that follows a smooth camera distance curve and a mid point of roughly 50% of the max distance.

So my question is can/how do I accomplish Option B or C? Is there a better way?

Get this bounty!!!

This site uses Akismet to reduce spam. Learn how your comment data is processed.