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 .NET / Collision detection ?

Years of Service
User Offline
Joined: 23rd Feb 2009
Location: Where ever Carmen Sandiego is
Posted: 3rd Oct 2011 20:41
Hey everyone I'm looking for some good collision detection examples for dark gdk .net before you point me in any direction let me explain a few things first to help you understand my problem.

Firstly I know how to use the default collision detection in dark gdk. I know how to tell when one object hits another however I need a good way to move along a ramp. For example I want to allow a character to travel over terrains until a certain degree. For example is the angle of the hill , stairs , whatever is greater 30% than don't allow the character to continue to travel. I know how to tell when two objects collide using box or polygon collision. However I want to make this work with hills , stairs , etc.

I thought about using the BSP function. However I realized BSP was more complicated than I thought and include lots of other information like , scripts , lights etc. I'm also very comfortable with .3ds and .X and would like to continue using those.

Hopefully that explains enough. Thanks for any help also I would prefer VB example but I can use C# , C++ as well.

"The reasonable man adapts himself to the world: the unreasonable one persists
in trying to adapt the world to himself. Therefore all progress depends on the
unreasonable man."
Retired Moderator
Years of Service
User Offline
Joined: 15th Apr 2003
Location: On a park bench
Posted: 5th Oct 2011 23:43

I know there are collision libraries that can work under DarkGDK.NET with a bit of work such as Nuclear Glory Collision library, but there may be an alternative when using the standard collision functions.

The proposed idea, would be to take the collision point of your character, and the collision point of the terrain, or ramp, and work out the elevation angle by using say, the dot product of the two vectors that make up the last position of your object, and the new position of the collision point. Because you're testing only the elevation of the angle for your object, you could probably get away with just working out the product of the Y co-ordinates of both vectors.

So basically, tracking the position of your object, and the collision point, should yield a vector of direction. By using the Y co-ordinate of your two positions, it should be easy enough to work out the angle of the two along a horizontal line.


Login to post a reply

Server time is: 2023-10-02 16:56:45
Your offset time is: 2023-10-02 16:56:45