Basically i’ve got my rigidbody to jump, but since the player can hit space many times, the rigidbody would almost fly… I mean, infinite jumps.
var keyJump = Input.GetButtonDown ("Jump");
// Jump
if (keyJump) {
rigidbody.velocity = Vector3(0,8,0);
}
I’ve googled it and it seems that some people use Raycast, but they say it does not work with spheres (my player is something similar to a sphere). I’d need some help figuring out the solution.
Thanks for reading
Yep, its a raycast, shoot it straight down and only as long as your radius + 0.2 or so. If it hits, you are “grounded” if not, you are not.
Another cool method is to use the OnCollisionEnter event and store the last collision that happens below the ball’s equator. do a Raycast in the -hit.normal direction with the same + 0.2 and if it hits you are grounded in that direction.
Even more funky, use that normal as the jump direction. 
If you character is a rolling sphere, sphere-casting down (using a smaller radius sphere to avoid roof conflicts) might work better, or iterate through contact points in OnCollisionStay and dot them against a down vector which would allow you to set/tweak a contact angle bias the character is allowed to jump off of.
The latter is handy for things like having slippery ice slopes that a character really shouldn’t be able to jump from because all vertical force would slip.