Search Unity

Make boundaries to camera

Discussion in 'Getting Started' started by selkeer, Feb 13, 2019.

  1. selkeer

    selkeer

    Joined:
    Sep 20, 2017
    Posts:
    7
    Hello,
    i would like to make boundaries for my camera so that it stays in the game field. I've seen many times on the web that the solution would be to clamp the x y z position or set a limit but it's quite impossible in my case (i think) cause my camera is rotated, so every time i move my camera, this is x y and z which change at the same time.
    Is there a way to solve this problem ?

    Thank you
     
  2. Kiwasi

    Kiwasi

    Joined:
    Dec 5, 2013
    Posts:
    16,860
    Options:
    • Do the math on the clamping zone. Then clamp the camera.
    • Add physics colliders around the area and use those to constrain the camera.