Character Controller Jittering Problem

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:

    var controller : CharacterController = GetComponent(CharacterController);
if (controller.isGrounded) {
    // We are grounded, so recalculate
     //move direction directly from axes
    if((Input.GetAxis("Horizontal") < -0.1) || (Input.GetAxis("Horizontal") > 0.1)){
        moveDirection = Vector3(0, 0, 1 * speed);
     }
    else
     {
        moveDirection = Vector3(0, 0, 0);
     }
    moveDirection = transform.TransformDirection(moveDirection);

    if (Input.GetKey ("w")) {
        moveDirection.y = jumpSpeed;
    }

}
else
{
    // Apply gravity
    moveDirection.y -= gravity * Time.deltaTime;
}

// Move the controller
controller.Move(moveDirection * Time.deltaTime);

//KEEP IT IN LINE YOU SLAG!
transform.position.x = depth;

and it's all housed in a 'FixedUpdate()' function

any ideas? thanks in advance

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

moveDirection.y -= gravity * Time.deltaTime;

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.