I’ve tried a few things, but they seem to be a bit buggy. What I want to do is essentially that, if not grounded (all ready a variable in the script), if you hold the jump button again your gravity (also a variable) will half. This is the hack I tried with it, but there are a few problems, including that your gravity can randomly double when jumping normally. Even for a miniscule second, this can have big affects.
if (!grounded) {
if (Input.GetButtonDown("Jump")) {
gravity = gravity / 2;
}
if (Input.GetButtonUp("Jump")) {
gravity = gravity * 2;
}
}
So any help in this matter will help bring me closer to a playable state for my prototype. Thanks!
Well, The problem is that when you jump normally, you are first in a “grounded” state, which won’t trigger the Gravity reduction. But when you release it, It will apply the gravity augmentation, unless you wait till you hit the ground to release it.
What I suggest you do is :
First, Set different constants for gravity. or actually, calculate them and store them in variables at the beginning. and make sure those never change