How to Make a Smooth 3nd Person camera zoom that has a facial focus?

What I Need to Do

I’m going to try to explain this best I can what I am attempting to do. I haven’t worked on coding in a year, so I’m a bit rusty.

I want to create a zoom that is fluid, and when you zoom out, the full character is central to the screen, but when you zoom in, it zooms in on the character’s face. I can find tutorials for a zoom, but it’s not smooth enough for me. I want it to be incredibly fluid. Any zoom I can find also defaults to zooming in on the center of the character, their torso, rather than their face.

This is how the default view (not zoomed in or out) should look like

This is how it should look like zoomed in

I don’t know how to code fluid zooming or focus zoom to the face.

My Attempt

Video

Main problems:

  • I highly doubt this is the optimal way to do it, I just threw whatever I could find together
  • The zoom is not smooth enough
  • The values are incorrect. At 300 spring arm length, the socket offset is supposed to be 0. In my attempt here, it’s 34 point sumthin sumthin. It’s messy and not the view I want the camera to be at. Socket offset should increase to 60 when fully zoomed in at 50 arm length.

Hopefully this is a clear explanation, I would appreciate it so much if someone could give me some tips on how to go about this.