Search Unity

Movement by touch slide

Discussion in 'Getting Started' started by Ridd, Apr 4, 2015.

  1. Ridd

    Ridd

    Joined:
    Mar 28, 2015
    Posts:
    4
    Hello!
    I'm try to manipulate my hero in 2D game by touch slide.
    What I have done now is:
    Code (CSharp):
    1. if(touch.phase == TouchPhase.Moved) {
    2.   Vector2  touchDeltaPosition =  Input.GetTouch(0).deltaPosition/30;
    3.   transform.Translate (touchDeltaPosition.x, 0, 0);
    4. }
    This code is working fine when I test my game on unity with remote android mobile but when I try to play on my mobile with builded game - it's not working well. I think on each mobile this movement will be different.
    What I can do?
    Thanks.
     
  2. Ridd

    Ridd

    Joined:
    Mar 28, 2015
    Posts:
    4
    I really need a help ;)