Jumping in a FPS question
In an fps game (first person shooter)
what is the best way to make a realalistic jump.
i tried a bunch of stuff i came up with and they all turned out to be really unrealalistic.
also when you are running and you jump, you kinda make a curb in the air traveling down.
do youhave to compensate for that or does it just happen when you implenment the jumping code.
also.
which do you feel is the best way for a bullet to travel, a certain distance a frame or just go to the target in the frame that it was fired.
and ideas on that too would be greatly appricated.
thanks alot
"What we do in life, echos in eternity" -- Gladiator
I haven''t actually tried it before but I''ll just give this idea. If it''s stupid - just ignore it 
When jumping you could start a sin wave and while the direction key is held you move further along the wave. If no direction key is pressed then you only move up or down.
This is probably what I would do to create a jumping effect.
Zeus

When jumping you could start a sin wave and while the direction key is held you move further along the wave. If no direction key is pressed then you only move up or down.
This is probably what I would do to create a jumping effect.
Zeus
I was thining about the sin wave also.
could you possibly put a little phesocode(not spelled right)
for that.
also.
when you said just go up if the forward or whatever key isnt pressed.
but my problem was how do you make that realistic with the fps going so fast.
i am using time based and i made it so it jumps slower and when it reaches a certain y direction. it drops at the same rate.
but that looks and feel very bad. and it is nothing like what they do in other games.
can you clear that up for me.
alsoin the first post. there was a bullet question.
can you also look over that.
i really appricate it that you are replying
could you possibly put a little phesocode(not spelled right)
for that.
also.
when you said just go up if the forward or whatever key isnt pressed.
but my problem was how do you make that realistic with the fps going so fast.
i am using time based and i made it so it jumps slower and when it reaches a certain y direction. it drops at the same rate.
but that looks and feel very bad. and it is nothing like what they do in other games.
can you clear that up for me.
alsoin the first post. there was a bullet question.
can you also look over that.
i really appricate it that you are replying

"What we do in life, echos in eternity" -- Gladiator
for both the jumping and the bullet i would treat the body as a point mass and apply Newtonian physics. Checking for a collision is up to you.
-j0nnii
-j0nnii
-jonnii=========jon@voodooextreme.comwww.voodooextreme.com
Falling should not be a constant rate because of gravity - gravity is an acceleration, so each fram not only do you move down, but the rate that you move down increases, so you fall faster each frame.
About bullets: Depends on the weapon. If its a pistol, rifle, or something simmilar, make the bullets instant. If its a rocket launcher where the projectile moves relatively slow, make it move some each frame. Either way, make sure you test all the space in between the old bullet position and the new one to make sure it didn't pass through anything.
[edited by - extrarius on January 25, 2003 5:49:14 PM]
About bullets: Depends on the weapon. If its a pistol, rifle, or something simmilar, make the bullets instant. If its a rocket launcher where the projectile moves relatively slow, make it move some each frame. Either way, make sure you test all the space in between the old bullet position and the new one to make sure it didn't pass through anything.
[edited by - extrarius on January 25, 2003 5:49:14 PM]
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk
So when jumping up.
have a pre jump speed and decrease until you get to your max jump height.
and then on falling.
take that speed and start increasing it until you hit the ground.
would you think that would make it more realalistic?
also can anyone clear up the sin idea that was in the second reply.
thanks again!
have a pre jump speed and decrease until you get to your max jump height.
and then on falling.
take that speed and start increasing it until you hit the ground.
would you think that would make it more realalistic?
also can anyone clear up the sin idea that was in the second reply.
thanks again!
"What we do in life, echos in eternity" -- Gladiator
The way I did jumping in Project:Ominous was like this (unfortunately, the physics in the release version for the 4E3 contest were broken):
Each frame, if the player is "grounded" (more later), don''t apply gravity, since it''s cancelled out by the normal force (in a simplified model). Otherwise we apply gravity as acceleration in the y-direction, causing it to integrate with velocity and thus position over time.
About grounding: the player is grounded (assuming a heightmapped terrain system for simplicity) when their distance to the ground is 0 (you might compensate with a height offset though, but that''s ignored here).
Anyway, you can only jump when you''re grounded (since otherwise you have nothing to push against). To jump, just apply an impulse in the y-up direction. Anything with a magnitude greater than gravity will cause the player to un-ground and move upwards, then gravity comes into play to pull them back down. Once you detect a collision with the terrain (or any platform), they''re grounded again.
As was said above, you''ll probably want to treat bullets as instant-hit, using ray-sphere collision or similar. For projectiles, discrete movement can work, but if the velocity is too great or the frame rate too high, you''ll miss collisions unless you (as mentioned above) treat the distance travelled over the last frame as a line segment.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links
Each frame, if the player is "grounded" (more later), don''t apply gravity, since it''s cancelled out by the normal force (in a simplified model). Otherwise we apply gravity as acceleration in the y-direction, causing it to integrate with velocity and thus position over time.
About grounding: the player is grounded (assuming a heightmapped terrain system for simplicity) when their distance to the ground is 0 (you might compensate with a height offset though, but that''s ignored here).
Anyway, you can only jump when you''re grounded (since otherwise you have nothing to push against). To jump, just apply an impulse in the y-up direction. Anything with a magnitude greater than gravity will cause the player to un-ground and move upwards, then gravity comes into play to pull them back down. Once you detect a collision with the terrain (or any platform), they''re grounded again.
As was said above, you''ll probably want to treat bullets as instant-hit, using ray-sphere collision or similar. For projectiles, discrete movement can work, but if the velocity is too great or the frame rate too high, you''ll miss collisions unless you (as mentioned above) treat the distance travelled over the last frame as a line segment.
Later,
ZE.
//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]
It''s not really a sine wave. It''s a quadratic curve. That happens automatically when you treat gravity as an acceleration.
[twitter]warrenm[/twitter]
those two last replys cleared it right up.
thanks alot for the replys
thanks alot for the replys

"What we do in life, echos in eternity" -- Gladiator
January 26, 2003 06:08 AM
You should make player''s movements vector based.
when jumping add some y acceleration to player''s acceleration vector.
when jumping add some y acceleration to player''s acceleration vector.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement