- Home /
Create a layer of gameobjects not affected by camera zooming?
I have a 2D game I'm working on that follows a character moving down an infinite slope. When the character jumps the camera will zoom out to show more of the terrain. This also zooms out things that shouldn't change size (like the sun, notification bars etc). I'm currently zooming the camera by changing it's orthographic size programmatically, and all the elements are gameobjects. How do I keep a layer of gameobjects that don't change size when the camera zooms out?
Thanks in advance!
Answer by Glurth · Aug 02, 2016 at 01:25 PM
Interesting Q! Two way's I can think to do this:
1) During a zoom, in addition to moving the camera, ALSO move the objects that should NOT zoom, such that they remain a constant distance from the camera, weather zoomed in our out. But, I forsee this having problems, like moving objects behind/through others . Even reserve scaling to compensate for the zoom could have the same problem.
2) Use two cameras, each assigned a particular layer. Put all the objects that SHOULD zoom, on one camera's layer, and put all the other objects on the other camera. Then, when it's time to zoom; zoom only that one camera.
Answer by akrot · Aug 03, 2016 at 01:45 AM
Why not use the UI for gameobjects that don't change position?
Your answer
Follow this Question
Related Questions
Lining up Fov's 0 Answers
Camera zooming in and out 1 Answer
Lens Effect 1 Answer
Mouse wheel zoom 1 Answer
Camera Zoom problem 1 Answer