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.

Author
Message
SageTech
19
Years of Service
User Offline
Joined: 3rd Dec 2004
Location: Orlando, Florida
Posted: 18th Mar 2007 10:29
I managed to finally get the character controller displacement commands working, and now I'm having a bit of trouble when it comes to jumping. What I'm looking for is a initial burst of upward movement, which then slowly decreases until the player starts falling down at an increasing velocity. However, Ive tried numerous things and I cant for the life of me get this to work. Any ideas?

Kenjar, yet another victim of NRS (N00b Relapse Syndrome) May he code in peace...

Philip
20
Years of Service
User Offline
Joined: 15th Jun 2003
Location: United Kingdom
Posted: 18th Mar 2007 13:15
This is easy. You keep the default gravity on and then apply an upwards and forwards vector once to the object.

For an example, look at the green cube in the Forces demo in the rigid bodies subfolder on your DarkPhysics installation.

Cheer if you like bears! Cheer if you like jam sandwiches!
"I highly recommend Philip" (Philip)
SageTech
19
Years of Service
User Offline
Joined: 3rd Dec 2004
Location: Orlando, Florida
Posted: 18th Mar 2007 13:42
@Philip

Ive got that much down, but I cant seem to get it to work with my control system, IE: if space key is pressed don't keep pushing it up, just initiate some sort of jump sequence, and wait till the players on the ground before allowing another jump to occur.

Kenjar, yet another victim of NRS (N00b Relapse Syndrome) May he code in peace...

Benjamin
21
Years of Service
User Offline
Joined: 24th Nov 2002
Location: France
Posted: 18th Mar 2007 14:29 Edited at: 18th Mar 2007 14:29
First declare a global, KEYDOWN_UP, then do this kind of thing:



Of course, you still have to detect whether the player is on the ground or not to allow it.

Tempest (DBP/DBCe)
Multisync V1 (DBP/DBCe)
SageTech
19
Years of Service
User Offline
Joined: 3rd Dec 2004
Location: Orlando, Florida
Posted: 18th Mar 2007 23:50
Ben, I tried something similar to that, and was detecting if the player was on the ground a number of ways(IE checking distance from ray cast, seeing if the last y position had changed any, etc.) And still no luck.

Kenjar, yet another victim of NRS (N00b Relapse Syndrome) May he code in peace...

Mr X
18
Years of Service
User Offline
Joined: 25th Sep 2005
Location: Universe, milkyway, sol-system, Earth...
Posted: 10th Apr 2007 12:50 Edited at: 10th Apr 2007 12:50
Haven't got that much luck with jumping (to be honest I juat can't make it work). But I think I know how to solve your problem. You can have two variables, one that stores the player position on the y-axis and one that store the y-position in the last loop. Then compare them with each other and if they are the same, the player are standing on someting. Then you can allow the player to jump again. Hope it helps (haven't tried to combine that with Dark Phisics, so I don't know if it will work).

Login to post a reply

Server time is: 2024-03-28 10:37:55
Your offset time is: 2024-03-28 10:37:55