Hey there!
I am trying to make a better ground check for my character controller, but I constantly having issues, where the fix for one issue brings another one like in a loop.
I use a spherical cast that occurs at the player's feet to detect whether they collided with the ground or not. When they do - the gravity gets reset to -2f once, since i saw that happen in the tutorial. But because the detection is spherical, there is an unwanted interaction where the player would snap to the ground whenever the sphere touches a ledge, essentially making jumping over an obstacle snap the character to the top of it.
And here are the fixes I tried: decreasing the size of the sphere or changing to a raycast DOES fix the issue, but a new problem arrives where the player can stay very close to the edge of the object and constantly accumulate gravity. Their collider is still on the object, so they dont fall, but because the raycast/spherecast projects downwards and doesn't hit any ground - it puts the player into an airborn state.
How can i prevent both issues from happening?