so i have a movement script that’s for a mobile game using UI button, ive already got the movement for X & Z (forward and sideward) but i couldnt get how to jump using UI button and isGrounded bool using Rigidbody (whenever i click the UI jump button it does an infinite jump because the isGrounded isnt working) i only intended it to jump once,
i know how to do it for a character controller so i thought its the same process but it still didnt work, anyway this is how i did the jump script
Rigidbody rb;
public Vector3 jump;
bool isGrounded; //im lost on how im gonna incorporate this
public float jumpForce = 5.0f;
void Start()
{
rb = GetComponent<Rigidbody>();
jump = new Vector3(0.0f, 5.0f, 0.0f);
}
public void Jump()
{
rb.AddForce(jump * jumpForce, ForceMode.Impulse);
}
//there was suppose to be another public void script here for the pointerUp in the event trigger but i lost my mind trying to find a way to make use of it