|
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
(comments are locked)
|
|
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. i am applying gravity each frame, i already had the code you gave in the script. the problem isn't vertical jitter it's that the controller seems to lag even though unity is running at 600fps. thanks though.
Mar 09 '11 at 09:58 PM
Freddie
No you're not. You're only applying gravity if you're not grounded. As I detailed, that doesn't work.
Mar 10 '11 at 04:16 AM
Jessy
(comments are locked)
|
|
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.
(comments are locked)
|
