here is my function for selecting objects
`select object
function PickObject()
for obj=1 to 262144
if object exist(obj)=0
exitfunction
else
inc obj,1
endif
next obj
if mouseclick()=0 then pickmode=0
if mouseclick()=1
`if pick object(mousex(),mousey(),1,obj)>0
if CurrentObject=pick object(mousex(),mousey(),1,obj)>0
if pickmode=0
PickDist#=get pick distance()
PickX#=get pick vector x()
PickY#=get pick vector y()
PickZ#=get pick vector z()
inc pickmode
endif
endif
if pickmode=1
pick screen mousex(),mousey(),PickDist#
DistX#=PickX#-get pick vector x()
DistY#=PickY#-get pick vector y()
DistZ#=PickZ#-get pick vector z()
endif
color object CurrentObject,rgb(255,0,0)
set object cull CurrentObject,1
set object wireframe CurrentObject,1
endif
`CurrentObject=pick object(mousex(),mousey(),1,obj)
SelectBox=find free object()
`make object box SelectBox,object size x(CurrentObject)+10,object size y(CurrentObject)+10,object size z(CurrentObject)+10
endfunction
now, what i want is to be able to left click any object on the screen and it gets bounding box around it and returns its id, this function doesn't work properly i have put this in main do loop. i need this to work with my editor but the problem is that pick object needs exact number of objects to work how can i get this working?