@Satchmo
This question sounds familiar...
In your code
intersectObjectDBC(0,0,object position x(zombie),object position y(zombie),object position z(zombie),object position x(10000),object position y(10000),object position z(10000),0)
bang=collide
you are not setting a variable to the return value of interscetObjectDBC. Get rid of bang=collide and rewrite the line to read:
bang=intersectObjectDBC(0,0,object position x(zombie),object position y(zombie),object position z(zombie),object position x(10000),object position y(10000),object position z(10000),0)
Also, make sure you setup the zombies to use sparky's collision before checking for the ray intersection:
for zombie=3000 to zombobj
rem sparky's dll - box collision
setupObjectDBC(zombie,0,0)
next zombie
One thing to note about using this ray-casting type colliion, it only checks for ray/plane intersection one direction at a time. That means to detect collision above, to the sides, behind, below - you'd have to cast a ray in all of those directions. And if you had a tall character and cast a ray from it's midpoint forward for example, you'd miss forward detection at it's feet or head. This type of collision is great for projectiles, or for contact with a terrain, but it's not ideal for multiple objects that could be bumping into each other from multiple directions.
To Nano's suggestion:
Might want to run some benchmarks (see if it could be faster than Sparky's ray casting for each object in multiple direction) to compare it to Sparky's.
It may be faster, but then again you'd have to do distance checks between each object which could be on a scale of total objects x total objects as opposed to total objects x 5 (assuming one ray cast from center front,back, side,side, top; or total objects x 20 (assuming 4 rays cast from each edge of a plane in each direction to ensure a wider area of detection). It depends on the total objects and the speed of the DLL versus the DBC calcs and how many rays you want to cast. The accuracy would probably be better with the distance check.
And one might be able to squeeze out a bit more speed by also eliminating ^2 in the distance calc:
rem if there will be a constant distance (size of a zombie say)
rem that the distance check will be, set it up once at
rem the beginning so you don't have to recalculate it or
rem reassign it. Remember, in Nano's suggestion we're
rem eliminating the sqrt so need the distance squared
collisiondist=14^2
.
.
.
for zombie = start to finish
if object visible(zombie)=1
for objhit=start to finish
x1=object position x(zombie)
x2=object position x(objhit)
y1=object position y(zombie)
etc.
dx=x2-x1
dy=y2-y1
dz=z2-z1
if ((dx*dx)+(dy*dy)+(dz*dz)) <= collisiondist
etc.
Enjoy your day.