- Home /
Choppy Character Rotation on Slopes
Hello. I have an animated player character with all the necessary scripts attached, including the 3rd person controller script that came with Unity. It all works well, except that as I move my character down any sloped terrain and try to change direction with the WASD keys, the rotation gets super choppy. This doesn't happen at all on flat terrain, mind you. I really have no clue where to start looking for the problem. Additionally, I only have any experience with C#, but the 3rd person controller is in Javascript, so I'm deathly afraid of tweaking it without guidance.
Any ideas?
Ok, I managed to make a rudimentary video to illustrate my problem. The link is here:
Do you have a character motor script attached too? If so, expand it and temporarily uncheck 'Sliding' to see if that eases the rotation.
Hmm, I don't. What's the point of the character motor script if you already have character controller script?
I don't know what the 3rd person controller standard bundles up, but the two serve different functions I think. Anyway, don't add it, I was just curious if its Sliding was the issue. Is YouTube an option for you?
Ok, I just figured out the problem. Now all I need is a solution. I believe what's happening is, in the brief moment my character "falls", going from a higher point to an insignificantly lower point, the script deter$$anonymous$$es that I am not grounded. Since I'm going down a continuous slope, this is probably happening once every few frames, making the turn controls deactivate every few frames (since you can't turn while in the air). Hence the choppiness. To solve this, I want to make a tiny buffer distance in which the character is still considered grounded (unless someone has a better solution in $$anonymous$$d). This way, he won't be "falling" as he goes down the slope.
Your solution sounds perfectly reasonable and a typical approach. Very simply, it's likely the raycast to check if you are grounded is a certain length - say 90 cm. Just increase that to say 110cm. It could be that easy.
Answer by WorldLink · Sep 12, 2013 at 10:34 PM
I've actually discovered that the best answer is to smooth out my terrain as much as possible. I had made some adjustments with the terrain toolkit that were in conflict with what the character controller script was expecting.