3D double Jump
Hello,
I know that there are a lot of similar questions, but none of them helped me. I created a 3DBuzz character. Trying to tweak it a little.
public void Jump()
{
if (TP_Controller.CharacterController.isGrounded)
{
VerticalVelocity = JumpSpeed;
}
}
I have tried with doublejump = true; false. I tried with timer, i tried with counting times "jump" was pressed. Nothing really works. Either i can fly off the ground and just keep on floating, or it doesn't jump at all. I think its really hard to put the definition for unity when and only when to double jump, as condition !isGrounded keeps on being true while in the air, thus i should give it another if or whatever condition to only press it once. But with no luck. If such code is not enough, i can paste it all.
EDIT!!!!!!!!!
Nevermind. My keyboard's space isn't working correctly, which meant, when i pushed it, it started to add lots of jumps.I switched to letter as last goto. It worked. So yeah... 4 hours lost due to keyboard :D facepalm
Code for others:
public void Jump()
{
if (TP_Controller.CharacterController.isGrounded)
{
VerticalVelocity = JumpSpeed;
jumptime = 0;
canJumpz = true;
}
else
{
if (canJumpz = true && jumptime < 1)
VerticalVelocity = JumpSpeed;
canJumpz = false;
jumptime++;
}
Your answer
![](https://koobas.hobune.stream/wayback/20220612072242im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
How to make a simple jump script in 3D C# 1 Answer
How can avoid my player to jump twice in the air? 0 Answers
How to use 3D colliders and rigidbody on 2D character controller 0 Answers
How can i combine Coyote Time and Jump Buffering with double jump? 0 Answers
Double jump feels really off 1 Answer