# Jumping?

## Recommended Posts

what is the format for jumping I lost?

##### Share on other sites
Perhaps you should rephrase that. To me it makes absolutely no sense what so ever, however that may be because I'm being rather thick.

Jumping in C++!

##### Share on other sites
LOL, nope, doesn't make sense to me either.

Perhaps K88soft is asking for the formula for jumping. How long is a piece of string?

##### Share on other sites
Jumping? There is no "jump" in C++. Are you thinking of the assembly JMP command? Or "goto" perhaps?

##### Share on other sites
JPG image format?

[repost]

##### Share on other sites
http://www.formatforjumpinginc++.com

##### Share on other sites
Wow, do you believe I fell for that...

##### Share on other sites
first you need to make sure that your system meets the standard minimum requirements. You must have a 64 processor SGI onyx super computer ($500,000 to$234,978,234,234,234 at your local best buy or circuit city).

you also must make sure that your header files meet the latest standard of JUMPAPI. Without it, your system is prone to crashes and weird behavior.

After you have met the first two requirements, call the following phone number and follow the directions:

0x92934 0x348178 10010001 24

If you are making an out of state call please die.

If you are catholic please hold.

If you are John Carmack give me a ferrari.

Finally, open microsoft visual studio 8billion, and create a new 'jump' workspace and include the line:

Jump(0);

good luck!

##### Share on other sites
When considering physics, jumping consists in an initial change of velocity of the character, which then leaves the ground. While in the air, he is only subject to gravity, which alters his velocity (and thus his movement) until a collision occurs.

If the initial change in velocity gives you an initial velocity of V0 (it's a vector), the position of the jumper is OM(t) and if the gravitational force is F, then at any time t after the jump, the position of the object would be:
OMx/z(t) = OMx/z(0) + tV0x/z
OMy(t) = OMy(0) + tV0y + t2F

Usually, F is -Mg, where g is 9.81 m.s-2 on Earth and M is the mass of the object, in kg.

However, this is a very bad approach to jumps in video games, since this prevents you from controlling the player during the jump. You have three aproaches there:

- Physics approach: keep the above formulae. Whenever a player jumps, he loses control.
- FPS approach: the y component of the movement remains the same, however the player still controls the x/z component as if he was on the ground (some games reduce the amount of control slightly while the player is in the air).
- Platform game approach: the player has full control over the x/z component. Also, the gravity is not constant: the player might keep the jump key pressed for a while. When it is first pressed (and the player is on the ground) F is set to 0. If the key is kept pressed, it increases slowly towards its normal value (the player jumps higher). If it is released, F automatically retrieves its normal value.

##### Share on other sites
to be honest i can't tell if he's talking about the mathematical physics thing or the c language version of try/catch. If you want a player to jump, your physics engine should already handle gravity for objects, so all you have to do is increase the upward component of the object's velocity (then your integrator handles positions etc)

o.O rephrase.

##### Share on other sites
Maybe you mean the setjmp and longjmp functions?

http://www.linuxgazette.com/issue90/raghu.html

edit: fixed typos. Shame, fingers... shame!

##### Share on other sites
Bad OP, keeping us guessing. I rated you down but for some reason it only increased your rating, so that kinda sux.

##### Share on other sites
[offtopic]
jumping?...goto?....trolling?...
[/offtopic]
really,just interesting what it was...

##### Share on other sites
no idea what just wasted my 30 seconds, but i do know im going to give the OP the lowest rating and hope this 'thread' gets deleted.

##### Share on other sites
I'm so sorry Iwas sleepy and then left for the weekend.

I was wondering were to get some tours for adding jumping in your game engine? help any?

##### Share on other sites

Quote:
 Original post by ToohrVykWhen considering physics, jumping consists in an initial change of velocity of the character, which then leaves the ground. While in the air, he is only subject to gravity, which alters his velocity (and thus his movement) until a collision occurs.If the initial change in velocity gives you an initial velocity of V0 (it's a vector), the position of the jumper is OM(t) and if the gravitational force is F, then at any time t after the jump, the position of the object would be:OMx/z(t) = OMx/z(0) + tV0x/zOMy(t) = OMy(0) + tV0y + t2FUsually, F is -Mg, where g is 9.81 m.s-2 on Earth and M is the mass of the object, in kg.However, this is a very bad approach to jumps in video games, since this prevents you from controlling the player during the jump. You have three aproaches there:- Physics approach: keep the above formulae. Whenever a player jumps, he loses control.- FPS approach: the y component of the movement remains the same, however the player still controls the x/z component as if he was on the ground (some games reduce the amount of control slightly while the player is in the air).- Platform game approach: the player has full control over the x/z component. Also, the gravity is not constant: the player might keep the jump key pressed for a while. When it is first pressed (and the player is on the ground) F is set to 0. If the key is kept pressed, it increases slowly towards its normal value (the player jumps higher). If it is released, F automatically retrieves its normal value.

##### Share on other sites
Ok thank you now how long will I be at 982?
that bites!

##### Share on other sites
Quote:
 Original post by K88softOk thank you now how long will I be at 982?that bites!

i have no idea what this means. what's 982?

-me

##### Share on other sites
my rating see it.
It's like I'm dumber than a monkey on dope!

##### Share on other sites
Here is the easy way to make a character jump.

Keep track of a jump velocity.

Whenever the player jumpes, set jump velocity to some number (whatever number will look good in your game). This determines how much force the player jumps off the ground with.

As your character is jumping, between each frame, decrease jump velocity by another number-- the higher this other number, the lower your character will be able to jump. This other number will be like gravity.

i.e.
jumpVelocity = 20;while ( playingGame){   playerY += jumpVelocity;   jumpVelocity -= 2   if ( playerHitsThefloor)        jumpV = 0;}

You can make this more complicated, by keeping track of gravity and the players jumping power separately, or doing other nifty things, but essentially you just need to make the player go up and come back down again. :)

i.e.
  playerY += jumpVelocity;  playerY -= gravity;   jumpVelocity = jumpVelocity / 2;

It's all about what looks good, unless you're doing a simulation of some sort of course.

Best of luck,
Will

##### Share on other sites
WOW thats cool I can't wait to try it out.

P.S.

##### Share on other sites
I'm closing this thread since the original poster didn't seem to be too serious.

##### Share on other sites
This topic is now closed to further replies.

• ### Forum Statistics

• Total Topics
628381
• Total Posts
2982360

• 10
• 9
• 15
• 24
• 11