I am developing a platformer with 2D gameplay and have a camera script set up that nicely follows the player character. Now, I would like to constrain this following movement:
If the player falls into a hole, the camera shouldn't follow, but let him fall out of the field of view.
If the level has an upper bound (like in tunnel), the amount visible above should be constrained, too.
For this, I need some kind of way to limit the camera's field of view to specific lower/upper bounds, ideally in a way that is independent of the camera's distance to the player (independent as in "allows for the camera distance to change and still work"). Is there a way to accomplish this with Unity?
Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.
The best place to ask and answer questions about development with Unity.
To help users navigate the site we have posted a user guide.
If you are a new user, check out our FAQ for more information.
If you are a moderator, see our Moderator Guidelines page.
We are making improvements to UA, see the list of changes.
For troubleshooting common problems with Unity 5.x Editor (including Win 10).
Answers and Comments
No one has followed this question yet.
How to make camera position relative to a specific target.
Access Unity Projector Buffer
Camera rotate with mouse in TPC
Line Renderer does not work with orthographic camera?
Camera follow player in code(C#)