Created
August 11, 2023 13:36
-
-
Save graylan0/913235aa058f31a7a08972acef4070e3 to your computer and use it in GitHub Desktop.
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
| The screenshot you sent me shows the Project Settings window in Unity. To fix the bug where the character slides backward when on a hill, you can follow these steps: | |
| Open the Project Settings window. | |
| Click on the Physics tab. | |
| In the Collisions section, find the Slope Limit property. | |
| Set the Slope Limit to a value that is less than the steepness of the hill where the character is sliding. | |
| Save your changes. | |
| The Slope Limit property controls how steep a slope a character can walk up without sliding. By setting the Slope Limit to a value that is less than the steepness of the hill, you will prevent the character from sliding backward. | |
| Here are the steps in more detail: | |
| Open the Project Settings window by clicking on the Edit menu and selecting Project Settings. | |
| Click on the Physics tab. | |
| In the Collisions section, find the Slope Limit property. | |
| The default value of the Slope Limit property is 45 degrees. If the hill where the character is sliding is steeper than 45 degrees, then the character will slide backward. To prevent this, you need to set the Slope Limit to a value that is less than the steepness of the hill. | |
| For example, if the hill is 60 degrees, then you would set the Slope Limit to 55 degrees. | |
| Save your changes by clicking on the Save button. | |
| Once you have completed these steps, the character should no longer slide backward when on the hill. | |
| Here are some additional tips for preventing characters from sliding in Unity: | |
| Use a higher friction material for the character's collider. | |
| Add a force to the character that counteracts the force of gravity. | |
| Use a script to check the slope of the ground and prevent the character from sliding if the slope is too steep. | |
| I hope this helps! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment