Created
August 2, 2016 17:03
-
-
Save framundo/2dafb6ee95fe6890aeb069010cde74e3 to your computer and use it in GitHub Desktop.
DragMove.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections; | |
using UnityEngine.Networking; | |
public class DragMove : NetworkBehaviour { | |
public float horozontalSpeed = 0.01f; | |
public float verticalSpeed = 0.01f; | |
void Update () { | |
if (Input.touchCount >= 1) { | |
Touch touch = Input.GetTouch (0); | |
if (touch.phase == TouchPhase.Moved) { | |
float h = horozontalSpeed * touch.deltaPosition.x; | |
float v = verticalSpeed * touch.deltaPosition.y; | |
transform.Translate(h, 0, v); | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment