- Home /
Zooming in and out with an orthographic camera, while the bottom edge is fixed.
I'm making a 2D golf game where the player can set the force and angle of a hit. I have the x position of the camera bound to the players x. I want the camera to zoom out so that the player can always see the ground (at about (0, 0)) and the ball at the same time. The camera then zooms back in as the ball gets closer to the ground. I basically want the camera to scale with the ball's distance to the ground.
My problem is, is that the camera zooms out from the center causing you to see below the bottom of the course, which also means it has to zoom much further out in order to see the ball and the ground. Is there a way that I can make the bottom edge of the camera stay in one place as the rest of it scales, short of translating the camera up as it scales, which I'm not so confident I could accomplish smoothly.
Sorry if this is a dumb question, I'm still somewhat new to unity.
Did you ever manage to do this? if so can you explain, I am trying to do the same thing with all 4 sides.