- Home /
2D camera zoom out by the distance of player to an object, Zoom in when it gets further away
I'm working on a sidescroller 2D plataform game, and I have a moment where there's a focus in the background in which i want to show to the player for an "aw" moment, and i want to zoom out the camera to show that moment and then zoom back in again. I guess you could say to do the same like Death's Gambit or hollow Knight when the object they want to show is too big for the size of the camera.
I want to make the camera zoom out with the distance to a certain point in the world, passing that point it stops zooming out, going backwards should zooms back in to it's initial position.
Tried to get the transform from the player in a certain area and calculate the distance to the point where i want the camera size to go to the max, and then calculate a percentage out of it to add multiplied by size difference but it would break the viewport making it spazz out or zooming out to the max unity allowed.
Thank for any answer
Your answer
Follow this Question
Related Questions
jittery collisions 2d platformer 1 Answer
Can't change direction mid-jump 1 Answer
2D Player Rotation 2 Answers
Copying movement for period of time 2 Answers