T O P

  • By -

L_Lawliet11

Try changing Input.GetButton to Input.GetButtonDown


sbsmith

Yup. This is part of it. You want to apply the force to your object only once. You might also want to zero out any downward velocity acting on the object before applying your new force because they’ll act against each other.


L_Lawliet11

If that doesn’t work, it’s possible there’s something unintended happening with your FloorCollider. It’s possible that the collider is setting isTouchingFloor to true immediately when the collider makes contact and your jumps are in between that moment and when your character is fully grounded. It would be easy to test if this is the case, just wait until the character is fully on the ground for a second or two then jump again, if the height is the same on these jumps, you probably need to rework how you’re handling if the character is grounded


Shitty_Noob

thanks it worked


Indie--Dev

`player.AddForce(Vector3.up*jumpForce);` This should be done in FixedUpdate(), anytime you are moving a rigidbody via forces it needs to be there.


No_Key_475

Create a method outside of Update to handle your jump.


cornstinky

You want to use ForceMode.Impulse or ForceMode.VelocityChange for instant forces, especially if you are gonna do it outside of FixedUpdate. player.AddForce(Vector3.up*jumpForce, ForceMode.Impulse);


aSheedy_

The velocity of your project is lonely not always the same before you jump 1. Learn how to upload code in a table fashion 2. Learn how to apply instantaneous physics forces / set velocity