Well you can use this formula, which is very slow and handles very big numbers. But i think in DB you can use vectors like in DBPro?
I have a very fast method, but it depends on how accurate you need your collisions. You can use the VECTOR commands, which are very fast!
Take the X/Y/Z positions from the object and SUBTRACT it from the X/Y/Z position from your player object. Then you can ask for the length of the resulting vector, which is the distance to the object!
This will boost up your performance!
Some code for VECTOR commands:
distvec = 1
pvec = 2
ovec = 3
ret = make vector3(pvec)
ret = make vector3(ovec)
ret = make vector3(distvec)
`** Your player position
set vector3 pvec, px#, py#, pz#
`** Your object position
set vector3 ovec, ox#, oy#, oz#
subtract vector3 distvec, pvec, ovec
`** Your distance between object and player
pdist = abs(length vector3(distvec))
Simply check the distance "pdist"!
Tom Taylor