Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

2D camera movement

Discussion in '2D' started by Drukalo, Feb 8, 2015.

  1. Drukalo

    Drukalo

    Joined:
    Feb 8, 2015
    Posts:
    4
    1)How do I make so when i move the camera (with touch) it doesnt go beyond the scene borders
    2)How to move camera with touch so it moves strictly with scene parts, like slides(swipe- first slide, another swipe- another slide) with not going beyond the borders of the scene
    The game i make has a camera like in Disco Zoo game for android
    (i am newbie)
     
  2. theANMATOR2b

    theANMATOR2b

    Joined:
    Jul 12, 2014
    Posts:
    7,790
    Not entirely sure I understand the problem, but here are a couple hints that may help.

    A camera can have a target which controls where it is looking. Maybe use this so the camera keeps it's orientation on what you want it to be looking at when it moves.

    Camera's can be limited by colliders - so if you want the camera to be limited to a specific area create a collider the camera can't go past.

    Hope this points you in the proper direction.
     
  3. sdviosx

    sdviosx

    Joined:
    Jan 4, 2015
    Posts:
    22
    Check out Touch Script on the Unity assets store. TS is a free advance multi touch library used to handle many touch gestures.
     
    theANMATOR2b likes this.