Well if I use this code as a function it runs alot slower
function MoveObject()
if mouseclick()=0 then PickObject=0 : MouseOverObject=0
Mclick=mouseclick()
if Mclick=>0 and PickObject=0 then
MouseOverObject=pick object(mousex(),mousey(),1,handel()-1)
if MouseOverObject>0
PickObject=Mclick
PickDistance#=get pick distance()
OPX#=get pick vector x()
OPY#=get pick vector y()
OPZ#=get pick vector z()
if PickObject=1
OOX#=object position x(MouseOverObject)
OOY#=object position y(MouseOverObject)
OOZ#=object position z(MouseOverObject)
endif
endif
if PickObject=1
pick screen mousex(),mousey(),pickdistance#
NPX#=get pick vector x()
NPY#=get pick vector y()
NPZ#=get pick vector z()
DPX#=NPX#-OPX#
DPY#=NPY#-OPY#
DPZ#=NPZ#-OPZ#
NOX#=OOX#+DPX#
NOY#=OOY#+DPY#
NOZ#=OOZ#+DPZ#
position object MouseOverObject,NOX#,NOY#,NOZ#
endif
endfunction
but if I use it as a label it runs alot faster I am making an error somewhere?
MoveObject:
if mouseclick()=0 then PickObject=0 : MouseOverObject=0
Mclick=mouseclick()
if Mclick=>0 and PickObject=0 then
MouseOverObject=pick object(mousex(),mousey(),1,handel()-1)
if MouseOverObject>0
PickObject=Mclick
PickDistance#=get pick distance()
OPX#=get pick vector x()
OPY#=get pick vector y()
OPZ#=get pick vector z()
if PickObject=1
OOX#=object position x(MouseOverObject)
OOY#=object position y(MouseOverObject)
OOZ#=object position z(MouseOverObject)
endif
endif
if PickObject=1
pick screen mousex(),mousey(),pickdistance#
NPX#=get pick vector x()
NPY#=get pick vector y()
NPZ#=get pick vector z()
DPX#=NPX#-OPX#
DPY#=NPY#-OPY#
DPZ#=NPZ#-OPZ#
NOX#=OOX#+DPX#
NOY#=OOY#+DPY#
NOZ#=OOZ#+DPZ#
position object MouseOverObject,NOX#,NOY#,NOZ#
endif
return