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 / 3D collision help plz

Author
Message
Mark3D
22
Years of Service
User Offline
Joined: 29th Mar 2003
Location: United Kingdom
Posted: 19th Dec 2003 19:06
Hi all,

I was wondering, how do i get my player (object number 1) stop when it collides with another model? Also, how do i stop my model from walking off the edge of my matrix? Thx guys.

Mark

Nature gave man 2 ends. One to think with, the other to sit on. Mans' sucess depends on which end he uses most!!
Emperor Baal
21
Years of Service
User Offline
Joined: 1st Dec 2003
Location: The Netherlands - Oudenbosch
Posted: 19th Dec 2003 20:27 Edited at: 19th Dec 2003 20:27
example of collision system




replace (matrix max) with the width/height number

Brandon Smith
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: Urbana, Illinois (USA)
Posted: 20th Dec 2003 00:11
That's really interesting Emperor Baal!, I'd never thought about using that approach to collision detection. So, thank you.

Also though, there are other methods that seem a little bit more intuitive to me. You could right something that went like this:

grab old positions

if(collision)
set object to old positions
endif

There are examples of this method in the DarkBASIC help file that I think are really good. They also have things on sliding collision and what nots.

Someone else will probably mention this anyway, so, if you have the Enhancement pack, there's a really really good dll that will take care of sliding collisions for you at www.nuclearglory.com.
Even if you don't have the enhancement pack, I found their example code on collisions and the way they set up their programs to be quite usefull, so you might want to check it out.

Good luck!
Brandon
Brandon Smith
21
Years of Service
User Offline
Joined: 19th Oct 2003
Location: Urbana, Illinois (USA)
Posted: 20th Dec 2003 00:23
bah, I left out a pretty important step for the collision detection logic. It should have been more like

get old object positions
move your object <<that's what I forgot

if collision
restore object to old positions
endif


Sorry about that..I THINK it's okay now

Brandon

Login to post a reply

Server time is: 2025-05-22 00:55:18
Your offset time is: 2025-05-22 00:55:18