-
-
Save khakionion/71b7680738268273121b to your computer and use it in GitHub Desktop.
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
void Update () | |
{ | |
if (Input.touchCount > 0 && Input.GetTouch(0).phase == TouchPhase.Began) | |
{ | |
HandleTouch(); | |
} | |
} | |
void HandleTouch() | |
{ | |
Touch touch = Input.GetTouch(0); | |
if(touch.phase == TouchPhase.Moved) | |
{ | |
Vector3 cameraRelativeDeltaPosition = screenXY2CameraXZ(touch.deltaPosition); | |
playerOffset.x = playerOffset.x - cameraRelativeDeltaPosition.x; | |
playerOffset.z = playerOffset.z - cameraRelativeDeltaPosition.z; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment