Hey there!
I'm making a 3rd person character controller and I need to check if the character is grounded so I can play the falling animations.
Right now I have a raycast going down from the base of the character a short distance to detect the ground collider which is being checked by the
Bool Test action. Ideally, once the raycast looses contact with the ground, it will send the event to start falling. However, as soon as the raycast starts, it detects False even if the character is on the ground and I can see the raycast passing through the ground.
I found this thread
Topic: Raycast ground detection goes wrong which applies exactly to my situation since I'm also using a capsule collider for my controller.
After reading that, I tried offsetting the
From Position vector of the raycast so it's not potentially touching the collider but changing those values don't seem to work as I expect and didn't move the raycast at all.
Another thing I tried was setting the player to the
Ignore Raycast layer but the raycast was still reading False. I also tried putting the character on it's own layer and using that in the
Layer Mask array field then checking
Invert Mask.
Am I going about this correctly or should I try something else to detect if the character is grounded or not?
Any help is appreciated! Thanks!