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 GDK / Sparky's collision: Sliding demo help

Author
Message
Chidz
14
Years of Service
User Offline
Joined: 20th Apr 2010
Location:
Posted: 20th Apr 2010 13:32
Hi all! and happy first post to me

I'm just getting into the dark gdk and whilst experimenting, i have come across Sparky's collision detection dll's. Seems like good stuff; I intergrated his sliding demo code into my test world and it seems to be working fine (you control a block that can walk up slopes,stairs etc).

My problem with the code itself is understanding how the SC_GetCollisionNormalY() function works. below is a code extract from the sliding demo for the vertical collision detection (seperate from horizontal):



Despite the comments i'm struggling to understand what exactly the get function SC_GetCollisionNormalY() returns IN THE CONTEXT OF THIS DEMO (and the dark gdk api doesn't provide a clear description of this function for me). How does this value, compared against the "slope" variable help determine the flatness of the ground? why is dbAbs() applied to it?

I guess i want to know the exact algorithm here, a rather than taking the authors word for it in the comments and copying the code. Everyone is welcome to shed some light
Chidz
14
Years of Service
User Offline
Joined: 20th Apr 2010
Location:
Posted: 23rd Apr 2010 22:45
Anyone....?
Chidz
14
Years of Service
User Offline
Joined: 20th Apr 2010
Location:
Posted: 27th Apr 2010 00:33
OK, I think I finally understand this code extract

I plan to explain this for the sake of anyone that may encounter the same confusion I had but I'm afraid this will take some drawings to make everything clear (illustrating gradients and vectors). I'm bogged down with a work at the moment so an explanation will come in my spare time.

If anyone wants to beat me to it feel free!

Login to post a reply

Server time is: 2024-07-07 01:56:38
Your offset time is: 2024-07-07 01:56:38