2D camera zoom in comparison to the height of target

I have a 2d vehicle moving along a 2d surface, and the camera is orthographic, and follows the vehicle side on as it moves. I need the camera to zoom in and out a bit when the vehicle jumps over a ramp, so the higher it goes the further out the camera zooms, or rather changes orthographic size, and then reverts back when the vehicle lands again, with smoothing, is this possible?

cheers - monster.

right ive worked out the body of the script, but how do I call in the ‘carHeight’ from the raycast on the gameobject, into the script on the camera? anybody?

It depends how you’re making your camera moves, but I guess it’s a child of the vehicle. So, when it jumps, the camera jumps to, changing it’s heights, and you want the size to change as well. This is what I would do in a script attached to the camera :

var : relativeHeight = (transform.position.y - minHeight) / (maxHeight-minHeight);
camera.orthographicSize = Mathf.Lerp( minSize, maxSize, relativeHeight );

If you can find the correct values for min and max, it should work.