Question by
bluieboy · Nov 13, 2015 at 01:47 PM ·
2d-platformercamera-movement
How do you move the camera when the player touches the edge of the screen?
Hello. I'm really new to unity so forgive me if this is simple. I'm making a 2d platformer. What I'm trying to do is have the camera move when the player touches the edge of the screen. Any help is appreciated. Thanks.
Comment
Answer by Tyche10 · Nov 13, 2015 at 03:36 PM
I am also new to unity, but I would check in update if the left/right edge of Renderer.bounds is equal to the left/right screen edge (by using Camera.ViewportToWorldPoint for example) and then calculating how much you want the camera to move and moving it (for example by using the Vector3.Lerp function).
Hope this helps.