Search Unity

Keep Ortho camera movement restricted to area.

Discussion in 'Scripting' started by littlelingo, Dec 26, 2009.

  1. littlelingo

    littlelingo

    Joined:
    Jul 18, 2006
    Posts:
    372
    Hi All,

    I have a visualization game where the user watches the AI elements on screen do their thing. We are using an Ortho camera to pull off the 2D effect and are using the size property to handle zoom in and out. When zooming in, the user sees a subset of the screen and they are allowed to move the camera around to see the other portions of the screen.

    The problem is, I am not real sure on how to restrict the camera movement to keep the view within the area (attached is a screenshot of the area I am talking about). I have looked at the camera rect but as suspected this is always 0,0,1,1. I also looked at becameVisible, etc. but because the rect is always 0,0,1,1 then all elements seem to be visible.

    Any help and thought would be very grateful! Thanks in advance for your help.
     

    Attached Files: