Skip to content

Instantly share code, notes, and snippets.

@framundo
Created August 2, 2016 17:03
Show Gist options
  • Save framundo/2dafb6ee95fe6890aeb069010cde74e3 to your computer and use it in GitHub Desktop.
Save framundo/2dafb6ee95fe6890aeb069010cde74e3 to your computer and use it in GitHub Desktop.
DragMove.cs
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