I try to make player jump with Rigidbody
but it doesn’t work.
checkCollider = Physics.OverlapSphere(groundCheck.position, groundRadius, groundLayer) // a collider with its parameters
if(checkCollider.Lenght > 0) {
isGrounded = true;
} else {
IsGrounded = false:
}
if(Input.GetKey (KeyCode.Space) && isGrounded) {
GetComponent<Rigidbody>().velocity = (GetComponent<Rigidbody>().velocity.x, jumpSpeed, GetComponent<Rigidbody>().velocity.z);
// I have the jumpSpeed variable