I'm horrible at physics, so I'm failing on this part. I want my object to start moving upwards on the Y-axis starting at the maximum peak rate, then gradually decreasing in velocity before it starts going back down in a natural curve as it would be in real life you wanted to jump. I just want the formula. The maximum fall velocity should be at 9.8, and the velocity will always be a float value.
First the variables that I use now:
The velocity value is the actual movement on the sprite that is subtracted on the Y-axis for the object. The gravity is set to a negative 9.8. The velocity starts at 9.
The handling of the velocity as soon as the jump occurs is like this right now (but it does not generate a smooth curve and does not compute as intended because I suck at physics):
It creates a really weird curve on the jump. I want a smoother curve.
Is there any formula that would allow this to be done a lot simpler and smoother than I am currently doing it with my lack of physics skills?
For reference, this is XNA 4.0 in C#.
Thanks in advance!
First the variables that I use now:
Code:
float Velocity;
float Gravity;
The handling of the velocity as soon as the jump occurs is like this right now (but it does not generate a smooth curve and does not compute as intended because I suck at physics):
Code:
if(!Jump){ Velocity = 9f; Jump = true; }
else if(Velocity <= Gravity){ Velocity = Gravity; }
else{ Velocity += (Velocity - Gravity) }
Is there any formula that would allow this to be done a lot simpler and smoother than I am currently doing it with my lack of physics skills?
For reference, this is XNA 4.0 in C#.
Thanks in advance!