Sphere get stuck in floor and fails to jump?

I have a rigid body with a sphere collider sitting on a floor. It has this in fixed update:

if (Input.GetKeyDown(KeyCode.Space))
{
    rigidbody.velocity = Vector3.up * 4;
}

If I try to jump as soon as the sphere reaches the floor, it will occasionally fail to jump (remains stationary). Since I am setting velocity directly instead of incrementing it, I know it isn’t being cancelled out by any existing negative velocity. Also, I don’t have any logic to ensure that the player is on the ground before letting them jump, so that’s not the problem either.

Any thoughts on how to fix this? Thanks.

For anyone else with this problem make sure to check for input in the regular Update() function and not in the fixed update function :slight_smile: