SHOW:
|
|
- or go back to the newest paste.
1 | void Update () { | |
2 | - | //********************************************************************************** |
2 | + | //********************************************************************************** |
3 | - | //||||||||||||||||||||||||||||| MOVEMENT ||||||||||||||||||||||||||||||||||||||||||| |
3 | + | //||||||||||||||||||||||||||||| MOVEMENT ||||||||||||||||||||||||||||||||||||||||||| |
4 | - | //********************************************************************************** |
4 | + | //********************************************************************************** |
5 | - | if (Input.touchCount > 0) // TOUCHSCREEN CONTROLS |
5 | + | if (Input.touchCount > 0) // TOUCHSCREEN CONTROLS |
6 | - | { |
6 | + | { |
7 | - | // Get movement of the finger since last frame |
7 | + | // Get movement of the finger since last frame |
8 | - | touchDeltaPosition = Input.GetTouch(0).deltaPosition; |
8 | + | touchDeltaPosition = Input.GetTouch(0).deltaPosition; |
9 | - | touchDeltaPosition.x *= touchSpeed; |
9 | + | touchDeltaPosition.x *= touchSpeed; |
10 | - | touchDeltaPosition.y *= touchSpeed; |
10 | + | touchDeltaPosition.y *= touchSpeed; |
11 | - | |
11 | + | |
12 | - | // Move object according to new positions |
12 | + | // Move object according to new positions |
13 | - | transform.Translate(touchDeltaPosition * Time.deltaTime); |
13 | + | transform.Translate(touchDeltaPosition); |
14 | - | pos = transform.position; |
14 | + | pos = transform.position; |
15 | - | transform.position = pos; |
15 | + | transform.position = pos; |
16 | - | } |
16 | + | } |
17 | - | //********************************************************************************** |
17 | + | //********************************************************************************** |
18 | - | //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
18 | + | //|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| |
19 | - | //********************************************************************************** |
19 | + | //********************************************************************************** |
20 | } |