Forum rules - please read before posting.

IsGrounded returning false when using Root Motion

Hi again, I'm using AC 1.82.5 and Unity 2022.3.57f1 and a player character with Root Motion applied and using the Unity Character Controller.
The bug is that when turning on root motion, isGrounded never returns true. This is apparently an issue with Unity's character controller isGrounded check, but maybe there's a solution I'm missing? Thanks for the help.

Comments

  • edited February 12

    Using a Capsule Collider instead of a Character Controller solved the issue apparently. Unfortunately, I really need the character controller for other scripts.

    I solved the issue for now by adding a capsule collider, setting it to trigger and commenting the line that references the CharacterController.isGrounded part in char.cs

  • Using the same calculations from the Capsule in the Character Controller instead of relying on the IsGrounded method from Unity solved the problem for now.

                public bool IsGrounded (bool reportError = false)
                {
                    if (_characterController)
                    {
                        // return _characterController.isGrounded;
                        return Physics.CheckCapsule (Transform.position + (UpDirection * (_characterController.height - (_characterController.radius / 2f))), 
                                                    Transform.position + (UpDirection * _characterController.radius / 4f), 
                                                    _characterController.radius * 0.45f, 
                                                    groundCheckLayerMask);
                    }
    
  • I'll look into this, thanks.

  • Thank you Chris!

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.