- Home /
Check if position is on screen
Hi there! Im started using Unity a couple of days ago, and im working on my first project, but im having a bit of a problem. Im making a 2.5d platformer, but im having issues with the camera, ill explain it in this photo:
I dont want the camera to actually follow the player, i want it to follow its positions, for example, while the player is below the red line, i dont want the camera to follow his y, so if he jumps the camera doesn't move on its y axis, but if he walks left or right, the camera changes its x axis, but, if the player goes above the red line, i want the camera to change its y position so the player doesn't go out of the screen, same goes if the player drops below the floor, for example if theres a hole in the ground, i want it to change its y position so it doesnt go out of view from the bottom.
One way i thought about doing this is checking if the position of the character is on the screen (although i want the red line to be a bit below the screen, and not its actual top), if its not, tell the camera to look at the player, and go back to the normal "follow only x" view, although im sure there are far better ways to do this.
I have yet to learn all of unity's built in functions, so im wondering if a bit of a third party help wont be too much to ask :)
Thanks in advance!
Your answer
Follow this Question
Related Questions
2D Platformer Demo Camera Follow script doesn't follow player 1 Answer
2.5D Platformer Camera 1 Answer
Camera View Problem 0 Answers