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.

Dark Physics & Dark A.I. & Dark Dynamix / Examples of how to jump using the character controller in Dark Physics.

Author
Message
Jammy
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 19th Apr 2009 09:12
Back in 2006 as part of the N-vidia competition I made a code snippet which showed how to jump using the character controller.

Example 1 - no collision detection.



Three years later during my entry to the community competition #1, I was tracked down by Zaibatsu who stated.

Quote: "The character won't jump if it's moving on sloped surfaces."


I checked, and sure enough, as the above code relies on changing Y coordinates to check if player is jumping or falling moving on a slope gives false results. I had not noticed this at the time because my game had no slopes.

After checking the forums, I could not find another easy example of how to jump. It became clear that collision detection was the only sure way to detect if the player was on the ground. I changed the above snippet to include slopes and collision detection using DBPs own System.

Example 2 - With DBP own Collision detection.




This was still not ideal, as to make the collision detection work I had to make the player model bigger than the character controller, which means the players feet would be below ground level. I suggested using an invisible actor positioned just below your player and using it for collision detection or using sparkys collision DLL and raycasting.

Zaibatsu stated

Quote: "The new jumping code works as long as you use a world made of individual boxes. If you build a world in a 3D modeling program and export it as a single model, then it doesn't exactly work. If you press and hole the spacebar, it will make your character hover up to the highest point on the map, and then kind of bob there until you release the spacebar."


I suggested some potential causes

1) Have you set your landscape to polygon collision? If not, It might just be one big cube of a collision box.
2) If using a sky sphere or box, make sure its collision is disabled.
3) If you have scaled your objects, Collision data may be messed up.
4) Try the SHOW OBJECT BOUNDS command to get an idea of your collision data.

and said once i got some time off work I would make a working example with a real model.

I came up with this.




Example 3 - using a real model and an actor positioned under the player.

Can be downloaded here

http://www.mediafire.com/file/zzzuwdjkkj2/LemmingDrop.zip

or attached to this post.

When I get some more time, I will make an example using sparkeys collision, as I still think this would be the best solution.

I moved our discussion here as it may be helpful to some people and would be unfair for them to try and find it in a work in progress post under a community competition board.

If you can improve my examples or have some of your own, please post them here. Or if you have any problems I will try and help.

Attachments

Login to view attachments
Zaibatsu
17
Years of Service
User Offline
Joined: 1st May 2006
Location: Lost in Thought
Posted: 27th Apr 2009 01:58
I'm sorry I've taken so long to respond, I've been busy and slightly sick for the last week, so I haven't really had any time for my hobbies. I've been looking at the code for the last little bit, and I'm still trying to figure it out. Thank you for the help, I'll post any questions I come up with while trying to figure this out.

Jammy
21
Years of Service
User Offline
Joined: 15th Jan 2003
Location: Scotland
Posted: 29th Apr 2009 10:33
Example 3b - using DBP own collision and an actor positioned under the player. With No Media needed.




This is just the last example with the media striped out for those who don’t like to download files.

castek
16
Years of Service
User Offline
Joined: 15th Aug 2007
Location: Right behind you!
Posted: 3rd May 2009 05:57 Edited at: 3rd May 2009 06:00
oops nvm

"The Beginning is the end."
Windows Vista Ultimate SP1
INTEL PENTIUM DUAL E2200 2.2 GHz 4 Gb RAM GeForce 9600 512 mb
Airslide
19
Years of Service
User Offline
Joined: 18th Oct 2004
Location: California
Posted: 6th May 2009 04:29
You could rotate the character controller on the x axis so it is facing up and then move it

Login to post a reply

Server time is: 2024-04-19 07:37:35
Your offset time is: 2024-04-19 07:37:35