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 Discussion / sliding collision using sparky's dll

Author
Message
greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 3rd Aug 2005 18:14
I was wondering if anyone could help me with sliding collision for a first person game. i have sparky's collision dll and found a good demo of how to use sliding collision with it on the code base but i couldn't understand how it was done. could someone please help me

ps. i am using a .x level and no matrix.

thanks in advance
blanky
20
Years of Service
User Offline
Joined: 3rd Aug 2004
Location: ./
Posted: 3rd Aug 2005 19:14
..You couldn't possibly go into more detail, could you?

'An X level and no matrix' isn't exactly the most verbose description of your requirements...

[Insert extremely witty comment here] :: Add me to MSN if you like, but don't expect any big favours [unless you like VB6]. ... IDK!!
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 3rd Aug 2005 21:35
actually it is.. just use the sliding collision demo and replace the model it has with your model

Your signature has been erased by a mod because it's larger than 600x120...
greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 4th Aug 2005 22:46 Edited at: 4th Aug 2005 22:47
i just read through what i posted and i can see why you need more detail so i'm sorry.
I have a .x model as my level. it is interior and therefore has a roof, floor, and walls on all sides. The reason i said about having no matrix is because if i was using a matrix i could use the 'get ground height' for part of the problem.
The game is an fps and what i was basically looking for was a system to stop the player walking through walls, falling through the floor etc.
If its not too much trouble could someone please tell me the basic principles of how sliding collision is done because then i can try and put it in my game but i can also adapt the same idea in other projects that may need slightly different ways of doing the collision on my own.
As i mentioned before i do already have sparky's dll if it helps.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 5th Aug 2005 01:09
yeah, you could just use the demo, and put the code into your own..

Your signature has been erased by a mod because it's larger than 600x120...
greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 5th Aug 2005 20:02
i did try to do that and i thought i changed everything to fit with my code but i couldn't get it to work.
Zotoaster
20
Years of Service
User Offline
Joined: 20th Dec 2004
Location: Scotland
Posted: 5th Aug 2005 20:35
hmm, there are lots of things to change, is your game 1st person or 3rd person?

Your signature has been erased by a mod because it's larger than 600x120...
greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 6th Aug 2005 09:48
Its a first person game like the one in the demo
greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 12th Aug 2005 11:16
Ok. i worked out how to do it now using a different method of sliding collision to the demo. I basically work out how far the user could move in the next loop and cast a ray to see if the new position would intersect a wall on each axis and then update the player position on that axis as needed. i can post the code if anyone else needs it.
devastation
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 16th Aug 2005 05:12
greg, did your new method make it so that you dont walk through walls wehn strafing and walking at same time?

If so, could u post the code?

Thanks
Jeff "devstation"
greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 8th Oct 2005 22:21
ok when i've re-written the code i will post it because the computer i had it saved on died on me (the flames on the motherboard made a bit of a mess of it). the code i had before wasnt perfect but it may have been possible to tweek it and it was harder to go through the walls than on another example of sliding collision using sparkys dll that i saw.
devastation
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 9th Oct 2005 04:09
changinge teh collision radius to 15 for the global variable near the top of the code will get rid of walking thru walls and using intersectObjectDBC to see if jumping will put u thru a cieling onto a roof

verydevastating.com
TDK
Retired Moderator
22
Years of Service
User Offline
Joined: 19th Nov 2002
Location: UK
Posted: 9th Oct 2005 07:38
If you want to know how to do simple collision with DB's collision commands, a few minutes ago I finished and uploaded my latest tutorial which just happens to be on that very subject.

It might give you an insight into how it's used.

http://www.matedit.com

TDK_Man

greg man
21
Years of Service
User Offline
Joined: 6th May 2004
Location:
Posted: 9th Oct 2005 17:44 Edited at: 9th Oct 2005 17:46
i thought i'd post my code anyway cos it runs quite fast i think and it might help someone. this is only a very rough version with no jumping or ramps included but it does seem to stop you going through walls quite well.



set the level or whatever you want to collide with to group 1 and it should work.

something like this has probably been done before but even if it has i couldnt find it

ps. this is dbpro code but i think you can convert it quite easily (it might work fine in dbc anyway)
devastation
19
Years of Service
User Offline
Joined: 11th Aug 2005
Location:
Posted: 9th Oct 2005 18:48
I put in some jumping in toggy's x level demo and fixed the walking thru walls. I could put the code up if it'd be useful.

verydevastating.com

Login to post a reply

Server time is: 2025-05-22 15:24:38
Your offset time is: 2025-05-22 15:24:38