Sign in to follow this  
K88soft

Jumping?

Recommended Posts

shadow12345    100
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 this post


Link to post
Share on other sites
ToohrVyk    1596
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 this post


Link to post
Share on other sites
shadow12345    100
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)

Share this post


Link to post
Share on other sites
Cherez    175
Maybe you mean the setjmp and longjmp functions?

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

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

Share this post


Link to post
Share on other sites
Eelco    301
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 this post


Link to post
Share on other sites
K88soft    100
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 this post


Link to post
Share on other sites
Palidine    1315
ToohrVyk already answered above:

Quote:
Original post by ToohrVyk
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 this post


Link to post
Share on other sites
Palidine    1315
Quote:
Original post by K88soft
Ok thank you now how long will I be at 982?
that bites!


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

-me

Share this post


Link to post
Share on other sites
RPGeezus    216
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 this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
Sign in to follow this