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 / need to know how can I do a Collision between a 3D obj and a level in 'DrakGDK'

Author
Message
yahya
15
Years of Service
User Offline
Joined: 16th Oct 2008
Location:
Posted: 13th Apr 2009 20:35
OK am really having trouple getting something like Sparkis Collision to work with me, I created a collision between 2 squares that are bult-in.
but when I try it with a 3D level and a 3D character, it doesn't work at all :S.


So can like someone post a simple code on how to do a collision between 2 inserted objs, I would really apreachate it.
CheatCat
17
Years of Service
User Offline
Joined: 7th Mar 2007
Location: Sweden
Posted: 20th Apr 2009 13:19
You need to download the latest version of Sparkys, v 2.05b.
lesPaul456
15
Years of Service
User Offline
Joined: 8th Apr 2009
Location:
Posted: 20th Apr 2009 21:02
If you want to use Sparky's collision detection, first set up the collision for the character. Something like:



"2" is the object id, "0" means no group, "1" means sphere collision.

Then, setup the collision for the level. For the level, you want to test for collision against each polygon.



The first "1" is the id of my level, the second "1" is the group it's in, "2" is the faces per node (2 is basic).

To stop you character from going through walls, you have to reset the character to it's last collision-free position. To do this, you must store the characters original position. Move the character, if there is a collision, set the characters position back.

To stop the character from going through the ground, you must do something similar, but you have to use sliding collision, or your character won't be able to move.

Check out the Sliding Demo that comes with Sparky's collision to see some code.

Login to post a reply

Server time is: 2024-09-30 23:10:00
Your offset time is: 2024-09-30 23:10:00