I am trying to get my character to jump higher when the jump button is held, at the moment i have a small just but when i hold the jump button the character will very slowly float upwards
help please, is there a way to get the character to reach a specific height in a faster ?
Can you show what you have got setup already?
you could make an enum with elements named JumpReady, JumpHeld, and JumpReleased. then you can make a variable of that enum type inside your character called JumpState.
when you press the jump button, you check if the JumpState is JumpReady, and if it is, you launch the character and change the JumpState to JumpHeld. also, pressing the jump button should set a boolean bJumpPressed to true, and on release, it should be set to false.
in EventTick, you check if the JumpState is JumpHeld, and if it is, you check if bJumpPressed is true. if bJumpPressed is false, you set the enum to JumpReleased, and you then check if the character movement’s velocity’s Z component is greater than a threshold number that you can adjust. if the velocity is greater, you set the velocity to that number. the number should be set to something less than JumpZVelocity.
using the character’s onLanded event, you can set the JumpState back to JumpReady.
this should give you a jump height that you can control by holding the button.