Distance function by cpltiffer7th Jun 2004 9:58
|
---|
Summary Function for distance of objects Description I've used an old formula and put it into a function to save the user of my snippet time. Code ` This code was downloaded from The Game Creators ` It is reproduced here with full permission ` http://www.thegamecreators.com function distance(obja.objb) xa#=object position x(objba) ya#=object position y(obja) za#=bject position z(obja) xb#=object position x(objb) yb#=object position y(objb) zb#=bject position z(objb) distance#=sqrt((xa#-xb#)^2 + (ya#-yb#)^2 + (za#-zb#)^2) endfunction distance# |