Created
February 23, 2013 19:28
-
-
Save NickDiMucci/5020984 to your computer and use it in GitHub Desktop.
A poor way to keep a player within the screen bounds in a Unity script.
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
player.transform.position = new Vector3( | |
Mathf.Clamp(player.transform.position.x, -8.0f, 8.0f), | |
Mathf.Clamp(player.transform.position.y, -10.0f, 10.0f), | |
player.transform.position.z); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment