I’m trying to make my character jump. I want to do this by checking that the character controller is grounded, and that the jump button has been pressed. Individually, these work correctly if(controller.isGrounded)
and if(Jump button pressed)
), but together they don’t.` Why not? If they are both true on their own, why aren’t they true one after the other?
EDIT: I’ve figured out what the main problem was: it was the fact that my character wasn’t moving along his yVelocity at all so I guess it couldn’t tell if it was grounded. However a new problem has arisen. Even when the method itself is invoked (that is, when the jump button is pressed and the character is on the ground) the Y Velocity doesn’t change. So the method is called but for some reason it won’t make the character jump? I’d say it’s about 60% of the time the character jumps and 40% it just ignores it.