I have structed up my script for giving the jump ability to the object but I’m not sure if the object is really jumping (although I applied Debug.Log() which it changes whenever the condition is met):
{
public bool isGrounded;
private float jumpSpeed = 8f;
private float ySpeed;
{
ySpeed += Physics.gravity.y * Time.deltaTime;
if (distanceToBall < 5 && Raycasting.ballHeight >= 2 && isGrounded == true)
{
isGrounded = false;
animator.SetBool("Jump", true);
ySpeed = jumpSpeed + 3;
Debug.Log("Jump" + ySpeed);
}
else
{
isGrounded = true;
animator.SetBool("Jump", false);
}
}
void OnTriggerEnter(Collider other)
{
if (other.gameObject.tag == "Ground")
{
isGrounded = true;
}
}
}
Thank you.