Last active
April 1, 2016 16:11
-
-
Save baileysh9/c7ed7b4248b8ef5537d2be9d680d6ea9 to your computer and use it in GitHub Desktop.
Unity Mobile Input
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 == 1) { | |
//Get the player and camera objects | |
GameObject player = GameObject.FindGameObjectWithTag ("Player"); | |
GameObject camera = GameObject.FindGameObjectWithTag ("MainCamera"); | |
//Change the character's position by moving in the direction that the camera is facing | |
player.transform.position = player.transform.position + camera.transform.forward; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment