I am trying to jump with rigidbody, and sometimes my jump is low like it stacks in something and sometimes is high. Why does it change?
thank's for the answers
My code:
private void Update() {
if (Input.GetKeyDown(KeyCode.Space) && isGrounded) Jump();
}
private void FixedUpdate()
{
isGrounded = Physics.CheckSphere(groundCheck.position, 0.2f, groundMask);
}
private void Jump()
{
rigidbody.AddForce(Vector3.up * 20, ForceMode.VelocityChange);
isGrounded = false;
}