Created
February 6, 2024 09:47
-
-
Save unitycoder/1a13f341bdedf03dd15e079033347555 to your computer and use it in GitHub Desktop.
Unity Limit Diagonal Speed (Horizontal, Vertical)
This file contains hidden or 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
| h = Input.GetAxisRaw(horizontalAxis) * walkSpeed * Time.deltaTime; | |
| v = Input.GetAxisRaw(verticalAxis) * walkSpeed * Time.deltaTime; | |
| if (h != 0 && v != 0) | |
| { | |
| h *= 0.7f; | |
| v *= 0.7f; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment