# Character keeps falling through the terrain and jittering

I honestly don't know what the problem could be anymore. I have a humanoid character with animations, and a charactercontroller.
I also have a ragdoll (seperately) that only follows the animations through script (doesn't do anything else). the ragdoll has a script on both feet, with colliders and rigidbody's, and sets a bool to true when either of them hits something. It also has an update function that casts a ray, and sets that same bool when it hits something. this way i know if it is grounded or not. the charactercontroller is also used to see if it is grounded or not.

In my control script I translate the character downward when it is not grounded, and set that gravity vector to 0 if it is.

the collisions work, the raycasts work, and the charactercontroller work, but still the character falls through. i've also tried increasing the solver settings, turning off auto simulation and PCM, increasing the contact offset to the point where it floats above the ground, and still falls through.

All the scripts use update functions, but the behaviour is the same in FixedUpdate. I tried with and without rigidbody's in the charactercontroller, and with and without charactercontroller itself.

this part of code is for movement:

bool walking = skaterParams.walking;

if (walking && !Onboard && !Helper.bailing) {
moveDirection.y = 0;

moveDirection = new Vector3(Input.GetAxisRaw("Horizontal"), 0.0F, Input.GetAxisRaw("Vertical"));
moveDirection = transform.TransformDirection(moveDirection);
moveDirection *= speed;
if (Input.GetKeyUp ("joystick button 1")) {
moveDirection.y = jumpSpeed  ;

}

}

if (!walking && !Onboard) {
moveDirection.y -= gravity * Time.deltaTime;
}
if (!Onboard  && !Helper.bailing) {
Char.transform.Translate (moveDirection * Time.deltaTime * 10);
}


i could also share the code for seeing if he is grounded, but i'm trying to limit the post here, to not have too much text. I just know it works, but it's just not consistent. When setting auto simulation to true, the ragdoll is also extremely jittery... the ragdoll and character are on seperate layers and cannot collide. The raycasts have a layermask set to the terrain layer.

## 1 Answer

I haven't actually found the solution but it did get fixed somehow. after I restarted unity, all was still buggy and jittery and not working, then i tested it with the animator turned off. and it worked again. after that, i turned it back on, and it still worked. So i'm guessing the problem was with the unity engine itself somehow. I'll try to see if i can reproduce it, and find a fix, if anyone has the same problems.

• I'm having a similar problem with a two cutscenes done with timeline and one works with the same character while the other one the character falls through terrain. Weird? Unity 2019.3. I cannot get unity 2020 working for me yet but been testing with it. – jeffery Sep 29 '20 at 23:27
• Could be cloth or model problems? But the animator solution is not working for me. Sorry if this is bumping this. – jeffery Sep 29 '20 at 23:38