I am trying to make a character that jumps when you hit X and glides if you hit X again before touching the ground. (yes, exactly like Spyro the dragon 1
What I’ve got so far is:
-If X is hit then the a tap force of 100 is applied for 1 game click launching him off the ground
-If X is hit and character is still off the ground then it enters another state where there is a constant Y force and a little Z force (to slow down the falling) is applied.
Here is where the problem begins. I am bad at describing it with words so I’ll use pictures!
The Green Line Represents the path the character follows when X is pressed at the top of the jump
The Blue Line Represents the path the character should follow when X is pressed at the middle of the jump
The Red Line Represents the path the character really follows when X is pressed at the middle of the jump
Notice how the red and the green lines come to the same height.
I know what is causing it, the velocity from the initial jump is continuing through to the next state. So maybe if I can find a way to freeze the velocity where it is? Or would it be practical to temporarily turn the character from a dynamic object into a static object until it touches the ground?
Does anyone have any ideas on how I can fix this? I don’t HAVE to use force for the initial jump, I’m sure there a better option out there I just don’t know about it due to inexpierince