Hi,
I have a script with a calculated, variable jump, and I dont know how to make the jump up faster than the falling down of the jump.
void Start(){
gravity = -(2*maxJumpHeight)/Mathf.Pow(timeToJumpApex,2);
maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
minJumpVelocity = Mathf.Sqrt (2 * Mathf.Abs (gravity) * minJumpHeight);
}
void Update(){
// JUMP
if(Input.GetKeyDown(KeyCode.Space) && controller.collisions.below){
velocity.y = maxJumpVelocity;
}
if(Input.GetKeyUp(KeyCode.Space)){
if(velocity.y > minJumpVelocity){
velocity.y = minJumpVelocity;
}
}
The problem is if I increase the velocity.y the jump just gets higher, cause there is nothing like a “highest jump position”.
Can you give me some advice?
Greetings J.