- Home /
CharacterController isGrounded confusion
Currently tinkering with my own 3D movement and I want to be able to see if my character controller is grounded. I understand that controller.isGrounded only goes to true if you apply some downward force otherwise the collider doesn't technically hit the ground just moves parallel, that's fine. My main confusion comes from the output depending on where it is accessed.
Using Debug.Log(controller.isGrounded) after my Move() will output True as it should, however if I put the log before Move(), it will say False when standing still, and both True and False if the character walks. My Move function is in Update() so I thought it would take the last Move() accessed, "Was the CharacterController touching the ground during the last move?" - from documentation.
I feel there's something simple I'm missing, so thanks for any help.
void Update () {
Vector3 movement = WalkAndRun(); // gets the direction vector
movement.y = -10f; // sets down force to 10
Debug.Log(controller.isGrounded); // this outputs false all the time, as well as true while walking
controller.Move(movement * Time.deltaTime); // move
Debug.Log(controller.isGrounded); // this outputs true all the time
}
Answer by Bored_Banana · Apr 16, 2018 at 03:04 PM
Found the problem. I was correct with needing to apply a downwards force (although didn't need to be so high). My problem was my animator controller had Apply Root Motion active which was somehow causing the whole thing to stay levitated for some odd reason, haven't looked into animations enough to know why but seeing as they were just random animations I just disabled the whole anim-controller for now
Check your Rigidbody in Controller an check "is $$anonymous$$imetic" and "Use Gravity". Should work even with your Animator enabled.