Posted: 30th Aug 2003 19:05
Just a box collision function thats way faster than the original collision functions.

+ Code Snippet
function collide(o1,o2,objectwidth,objectdepth,objectheight,nocollide,maxobjects)
yep=0
if o1<>o2
if o2>0
if object position x(o1)<object position x(o2)+objectwidth and object position x(o1)>object position x(o2)-objectwidth
if object position z(o1)<object position z(o2)+objectdepth and object position z(o1)>object position z(o2)-objectdepth
if object position y(o1)<object position y(o2)+objectheight and object position y(o1)>object position y(o2)-objectheight
yep=1
endif
endif
endif
endif
if o2=0
for j=1 to maxobjects
if object position x(o1)<object position x(j)+objectwidth and object position x(o1)>object position x(j)-objectwidth
if object position z(o1)<object position z(j)+objectdepth and object position z(o1)>object position z(j)-objectdepth
if object position y(o1)<object position y(j)+objectheight and object position y(o1)>object position y(j)-objectheight
yep=1
if j=nocollide then yep=0
endif
endif
endif
next j
endif
endif
endfunction yep


A simple collision function.
You must specify what objects to check for collision for o1 and o2.
objectwidth and objectdepth should be the width and depth of the collision box for o2
should o2 be 0, the function will search for collision from 1 to maxobjects
if nocollide is >0, if an object collides with the object specified
in nocollide, it will return 0.

Edit: Put code in code snippet box, source button screwed up the code. Rich, could you add code editing when editing posts?

Yet Another Edit: Forgot to have it check for y collision, heh.

Yet Another Edit: I'm an idiot, I didnt check my code entirely to see if it worked completely right, found 6 bugs which are now fixed, and it should work now!
Posted: 1st Sep 2003 13:47
Nice code! Kaboom said the Chickens 3!
Posted: 1st Sep 2003 16:07
Finally, someone read my profile!
Posted: 2nd Sep 2003 2:38
Feel like I'm posting on a dead thread but...

Did anyone actually try it? Does it work with your programs? Did I really screw up and embarrass myself? Somebody please answer.
Posted: 5th Sep 2003 1:58
???

PLEASE SOMEONE FOR THE SAKE OF HUMANITY, PLEASE TELL ME I DID SOMETHING RIGHT FOR ONCE!!! DOES IT WORK? DOES IT NOT WORK? PLEASE TELL ME!!!!! I'M BEGGING YOU!!!
Posted: 5th Sep 2003 22:11
NWC, I will try it out Talk to ya on AIM.
Posted: 6th Sep 2003 20:34
Kaboom said the chickens 3! Cool Code.
Posted: 7th Sep 2003 2:57
Kaboom said the Chickens 3!
Posted: 7th Sep 2003 3:24
Hey! You stole my idea!!!!!!!!!!!! i hate you!
Posted: 7th Sep 2003 5:07
Yep works for me, great code

Kaboom said the Chickens 3
&
Blind Chicken tied to a fence post!##!
Posted: 7th Sep 2003 6:18
NWC - I did something similiar to this, only I created a function to create the object collision box similiar to what you are doing here, with Object Width and what not.

Lookin good

RPGamer