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.

DarkBASIC Professional Discussion / A correct collision system?

Author
Message
Qqite
16
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 6th Sep 2010 21:18
I'm working on a program that I want to have a object jump, walk, and be able to walk to slopes to a certain extreme.

There was an amazing video I saw ages ago that went over everything to have an object move up slopes to a certain extreme, and if the slope is too steep, the object jsut slides down.

If anyone knows a video similar to this I will give you 100 cookies and a gallon of milk.

If no one knows a video then my question would be: What is the command/function needed to check collision only under the player, and to check if the slope of that collision is at what degree?

Ventures of the worlds around us are only limited by imagination.
baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 6th Sep 2010 21:33
Here is the best resource you'll find. I suggest Sparky's collision as it's accurate and fast:
http://forum.thegamecreators.com/?m=forum_view&t=95770&b=7

Qqite
16
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 6th Sep 2010 23:21
Btu is there anything in their that shows how to make collisions react to different slopes? Only thing I see is sliding collision but not much of angles :\

Ventures of the worlds around us are only limited by imagination.
Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 6th Sep 2010 23:39
One of the examples has a full sliding example :p

Qqite
16
Years of Service
User Offline
Joined: 28th Feb 2010
Location: Florida, U.S.
Posted: 7th Sep 2010 00:23
Yea I have sliding in my program, but I'm wanting to be able to have it check to see if the collision below an object of what angle it is. Otherwise saying if the slope is < 60* then allow control of character, else continue sliding down y.

Ventures of the worlds around us are only limited by imagination.
dark coder
23
Years of Service
User Offline
Joined: 6th Oct 2002
Location: Japan
Posted: 7th Sep 2010 05:53 Edited at: 7th Sep 2010 05:54
You can retrieve the normal(direction unit vector) of the surface hit from all the raycast commands in Sparky's DLL, so yes.

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Sep 2010 12:37
After detecting a collision using sparky's Sphere Sliding collision detection just retrieve a normal in Y using:


If it's over a certain amount (0.7 is roughly 45 degrees) then you slide otherwise you don't.

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 8th Sep 2010 19:01
Sorry to hijack, but how do the result that the normal command return relate to actual angles?

If i didn't make my question clear enough, how does 0.7 relate to 45 degrees?

baxslash
Valued Member
Bronze Codemaster
19
Years of Service
User Offline
Joined: 26th Dec 2006
Location: Duffield
Posted: 8th Sep 2010 19:14
If the normal was pointing straight up (like off a flat floor) it(sc_GetCollisionNormalY()) would return a value of 1.0. If it was a wall it would return 0.0.

At 45deg you have a hypotenuse of 1.0 so the normal in y would be about 0.7. It's just Pythagoras, if you imagine the hypot/normal is always 1.0... hope that makes sense I'm just going out the door...

Indicium
18
Years of Service
User Offline
Joined: 26th May 2008
Location:
Posted: 8th Sep 2010 19:41
ah right, I understand now, the sin of 0.7 is roughly 45 Thanks xD

Login to post a reply

Server time is: 2026-07-22 12:41:08
Your offset time is: 2026-07-22 12:41:08