controller.isGrounded is only calling true while I am moving and not standing still. I couldn’t find any other answers that seem to have worked online. Not only does it not work while I am standing still it also doesn’t work while walking down stairs or slopes where as walking up them works fine. Any help would be appreciated.
your code for determining if the player is grounded is in the controller script, which you’re referencing in this script, but aren’t actually showing, so there’s no way to determine whats wrong based off of what’s here.
The “controller” is a reference to the CharacterController component which is retrieved in the Start Function so it’s Unity Engine’s method of checking ground collision.
The animation is what actually moves the character, I learned it from a very nice tutorial on YouTube and it’s actually very basic and reliable. Here it is in action, I warn you mute the video. My mic is buzzing like hell and I don’t know why lol.
I’ve also fixed what I was trying to fix with help from taking some information from a Brackeys video. It now works as expected and I replaced the entire ground checking and jumping in my script with this.
#region Jumping And Ground Check
//Phsyics Check To Ground
isGrounded = Physics.CheckSphere(groundCheck.position, groundDistance, groundMask);
//If The Player Is On The Ground Stick To Ground And Reset Vertical Velocity
if (isGrounded && verticalVelocity < 0)
{
verticalVelocity = -stickToGroundForce;
}
//Jump If The Player Is Grounded
if (isGrounded && Input.GetButtonDown("Jump"))
{
verticalVelocity += jumpForce * stickToGroundForce;
}
//Gravity
verticalVelocity -= characterGravity * Time.deltaTime;
//Apply These Calculations To The Actual Player Controller
Vector3 fallVector = new Vector3(0, verticalVelocity, 0);
controller.Move(fallVector * Time.deltaTime);
#endregion
I fixed this issue Setting Min Move Distance Character Controller value to 0. Now, controller.isGrounded works just as expected. I found it in a forum and it seems to work fine.
Adjust the skin width in character controller may be sometimes it will working for you. in my case i adjusted skin width 0.8 to 0.0001 it perfectly worked for me
Same. I can zoom in on the collider after it drops and it’s actually sticking into the ground and still reports as “False.” If I just remove the conditional to check if it’s true, it will report true. Which I guess would be fine if I didn’t have conditions I needed to check, lol.
to be clear while setting the min move distance to 0 helps a lot, it still will fail to detect the ground when it’s probably just a couple centimeters below your feet. Is there a way to increase the distance threshold for counting as grounded without doing an additional collision detection?