Search Unity

Android Swipe to move Camera

Discussion in 'Scripting' started by MysteriX, Jul 30, 2014.

  1. MysteriX

    MysteriX

    Joined:
    Apr 8, 2014
    Posts:
    54
    Hi,

    i would like to know how to move a Camera which is set to orthographic.
    Rotation is set to 45,45,0.

    I want to use the known workflow to just swipe with one finger over the display. The movement also shall not stop instantly if i stop swiping. It Should lose velocity until it stops.

    I was looking for example code. But all i found was not really helpfull.

    Thank you!
     
  2. MysteriX

    MysteriX

    Joined:
    Apr 8, 2014
    Posts:
    54
  3. lrlelaldl

    lrlelaldl

    Joined:
    Jul 27, 2014
    Posts:
    75
    You'd move it the same way you'd move anything else really, it's just another gameobject that renders.
    How would you handle that movement if it was say your player?
     
  4. MysteriX

    MysteriX

    Joined:
    Apr 8, 2014
    Posts:
    54
    I think it is not the same.
    To move the player i simply would click to a position. To this position the player walks then with the same speed over time.
     
  5. lrlelaldl

    lrlelaldl

    Joined:
    Jul 27, 2014
    Posts:
    75
    Same type of thing really. You could put a rigidbody to the camera that is kinematic and apply a force in the opposite direction of the swipe equal to the length of the swip movement, I would think that it would have the effect you were looking for