hey, i'm having some problems using the character controller, i've checked all over the web but i can't find any reason for it jittering.
this is my code:
and it's all housed in a 'FixedUpdate()' function
any ideas? thanks in advance
asked Feb 11 '11 at 07:24 PM
You have to apply "gravity" every frame, otherwise it pops out of the ground continuously. I remember providing some code to fix this at some point, on the forum, but the basic idea is that you just set moveDirection.y to the smallest negative value you can, every frame you're grounded, that fixes the issue. That way, when you walk off an edge, you aren't falling really fast immediately, which would happen if you just took
out of the else statement.
And no, the scripting example has never accounted for falling off an edge properly.
Edit: Here is that forum post.
It sounds like an issue with using FixedUpdate/Update/LateUpdate. If you move your character in FixedUpdate, and move your camera in Update, you'll get quite severe jitter. Seeing as there is nothing in your code above that really requires a fixed timestep, try moving it into Update and see if that helps.
answered Apr 17 '11 at 06:19 PM