Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Newcomers DBPro Corner / FPS jumping?

Author
Message
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 4th Jul 2003 02:28
i'm programming a FPS game but i cant get jumping in my game, can some plz help me?
Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 10GB HD, Riva TNT2 Ultra 32mb
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 4th Jul 2003 04:52
Might want to post some source code so we can see how your moving your character etc.

But taking a stab at it, you'd probably just want to move the camera up/down the Z axis with something like:



Then set a timer for how long he should be in the air for and once it's run out, set the jumpheight to a negative value and he'll come back down. I'm sure you can expand on this though, it's just a simple example.

"Computers are useless they can only give you answers."
Mussi
21
Years of Service
User Offline
Joined: 27th Jan 2003
Location: Netherlands
Posted: 4th Jul 2003 13:49
the prob is that if I position the camera a bit higher is that I get a jerky jumping. it needs to jump fluently. someone knows how to do that?

Specs: AMD Athlon 1800, 256 DDRRam 266mhz, 10GB HD, Riva TNT2 Ultra 32mb
TeePee
21
Years of Service
User Offline
Joined: 18th Apr 2003
Location: Australia
Posted: 4th Jul 2003 14:42
right well the way i interpreted what you just said....you didnt understand exeat properly. if you do his way properly it should be nice and smooth. a code like this should work well



i havent tested that or anything but if you just adjust that for you code it should work pretty well

Van B
Moderator
21
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 4th Jul 2003 15:57 Edited at: 4th Jul 2003 15:59
That's a pretty weird way to handle a jump right there!

You need a vertical (Y) speed that you can use to handle gravity and jumping at the same time. The Y speed should be a little below 0 when theres a ground collision, that way when you step off a ledge, it uses the gravity too.

Say your player Y position was called PLY# and the speed PLYS#. Groundcollision is just a flag that indicates if the player can jump - otherwise you'll be playing as superman!.

This would change the PLY# variable and speed variable for easy gravity and jump handling:

If PLYS#>-5.0 then dec PLYS#,0.05
inc PLY#,PLYS#

Now, how easy is this to impliment as a nice arc jump:
If spacekey()=1 and groundcollision=1 then PLYS#=1.0


You would need to experiment with the [-5.0, 0.05, and 2.0] values to get it right, but that's no biggie. That's how I do all my jumping routines. If you check the variance in ground heights and apply that to the Y speed, you can fly off ramps etc - not really applicable in an FPS I know, but you might want to add vehicles ala Halo.


Van-B

My cats breath smells of cat food.
Dave J
Retired Moderator
21
Years of Service
User Offline
Joined: 11th Feb 2003
Location: Secret Military Pub, Down Under
Posted: 4th Jul 2003 16:32
lol, damn, I must've been really tired when I posted that. Move the player Up and Down the Z Axis. That's not even possible. rofl.

"Computers are useless they can only give you answers."
Megaman Zero
21
Years of Service
User Offline
Joined: 25th Jan 2003
Location: United States
Posted: 6th Jul 2003 14:12 Edited at: 6th Jul 2003 14:12
Hey all, ive been following this post for a while, just to see if it will work with some of the codes that I have (more specificaly thedarthsters 20 line winner for the first person movement,) & whenever I enter the game to try out the spacebar, it doesnt jump, all it does is sits on the ground almost like he is walking.

Would any of your happen to know how to get around this? I will attach my code...

If someone sees a problem in my code, please tell me how to correct it.

Thanks,

Login to post a reply

Server time is: 2024-09-20 13:29:24
Your offset time is: 2024-09-20 13:29:24