Last active
September 7, 2021 02:09
-
-
Save curious-username/5a43ce4b994d13d2b9ea018eae815287 to your computer and use it in GitHub Desktop.
Unity Example of border limits
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
if (transform.position.y > 5.7f) | |
{ | |
transform.position = new Vector3(transform.position.x, 5.7f, 0); | |
} | |
else if (transform.position.y < -5.7f) | |
{ | |
transform.position = new Vector3(transform.position.x, -5.7f, 0); | |
} | |
else if (transform.position.x > 11.35f) | |
{ | |
transform.position = new Vector3(-11.35f, transform.position.y, 0); | |
} | |
else if (transform.position.x < -11.35f) | |
{ | |
transform.position = new Vector3(11.35f, transform.position.y, 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment