i used someones distance function and put it into a function i made to move an object to another object at a given speed until they are a given distance apart. I dont know who made the distance function, though and would like to give them credit before i submit the code to the codebase
the distance function is
function dist_obj(o,o2)
ox#=object position x(o2)
oz#=object position z(o2)
oy#=object position y(o2)
dx#=object position x(o)-ox#
dz#=object position z(o)-oz#
dy#=object position y(o)-oy#
dist#=sqrt((dx#*dx#)+(dz#*dz#)+(dy#*dy#))
endfunction dist#
my function is
function moveobj(obj1,obj2,speed,enddist)
if movedone=0
ox#=object position x(obj2)
oz#=object position z(obj2)
oy#=object position y(obj2)
dx#=object position x(obj1)-ox#
dz#=object position z(obj1)-oz#
dy#=object position y(obj1)-oy#
dist#=sqrt((dx#*dx#)+(dz#*dz#)+(dy#*dy#))
if dist#>100
Point Object obj1,Object Position x(obj2),Object Position y(obj2),Object Position z(obj2)
move object obj1,speed
movedone=0
endif
if dist#=<enddist
movedone=1
endif
endif
endfunction movedone
did a seach and i believe that David T wrote the function the thread is
http://www.thegamecreators.com/?m=forum_view&t=27484&b=7