How can avoid my player to jump twice in the air?
Hi! How can avoid my player to jump twice in the air? I want to make the thread wait until it has touched the ground again.
private void FixedUpdate()
{
rb.velocity = new Vector3(joystick.Horizontal * 5f, rb.velocity.y,
joystick.Vertical * 5f);
if (!jump && joybutton.Pressed)
{
jump = true;
joybutton.Pressed = false;
rb.velocity += Vector3.up * 10f;
}
if (jump && !joybutton.Pressed)
{
jump = false;
}
}
Comment
Your answer
Follow this Question
Related Questions
How can i make my player look at the same direction where its moving? [JOYSTICK ANDROID] 0 Answers
I need help fast! Cant jump while moving in Android 1 Answer
Joystick and character not matching up 1 Answer
Android joystick doesn't work after 2nd level >.> 2 Answers
How to place sprite above GameObject? 2 Answers