the best thing to explore and learn well is the distance function.
It can alleviate a massive slowdown with heaps of objects when collision is involved.
it can also prevent having to use a collision check for certain aspects,like getting close to a cube for a teleport like action.
here is a snippet that demonstrates the distance function as well as remarks where to place the collision factor if you want to.
rem -----------------------------------------------------------------
rem
rem
rem
rem
rem
rem -----------------------------------------------------------------
cls : sync rate 0 : sync on : randomize timer()
set text font "verdana" : set text size 14
make matrix 1,500,500,10,10
position matrix 1,-250,0,-250
make object cube 1,10
position object 1,0,0,-100
make object cube 2,10
position object 2,0,0,50
make object cube 3,10
position object 3,0,0,100
make object cube 4,10
position object 4,0,0,150
position camera 0,200,-300
point camera 0,0,0
do
if upkey() = 1
position object 1,object position x(1),object position y(1),object position z(1)+1
endif
if downkey() = 1
position object 1,object position x(1),object position y(1),object position z(1)-1
endif
obj1x# = object position x(1)
obj1y# = object position y(1)
obj1z# = object position z(1)
for obj = 2 to 4
obj2x# = object position x(obj)
obj2y# = object position y(obj)
obj2z# = object position z(obj)
point camera object position x(1),object position y(1),object position z(1)
dist# = getdist(obj1x#,obj2x#,obj1y#,obj2y#,obj1z#,obj2z#)
if dist# < 30
text 10,50,"can check obj collision with obj " + STR$(obj)
text 10,70,"30 units or and less"
` turn on DB collision
` place the DB collision check here
`turn off DB collision
endif
next obj
text 10,10,"distance " + STR$(dist#)
text 10,30,"fps " + STR$(screen fps())
sync : loop
function getdist(obj1x#,obj2x#,obj1y#,obj2y#,obj1z#,obj2z#)
distance# = SQRT((obj1x#-obj2x#)^2+(obj1y#-obj2y#)^2+(obj1z#-obj2z#)^2)
endfunction distance#