I see alot questions, I don't know this has been done already, because I don't need it, but I've been playing around a bit. And I have made a function. It's very simple. It just makes a tiny little sphere that moves from your camera position and then 1000(meter?) away. When it collides the function returns the number it collides to otherwise zero is returned. This is the function with an example program how to use it:
rem Initializing and making a scene
sync on
autocam off
make object cube 1,10
make object cube 2,20
make object cube 3,5
make object cube 4,30
make object cube 5,10
make object cube 6,20
make object cube 7,5
make object cube 8,14
position object 1,0,0,50
position object 2,20,40,10
position object 3,-20,0,20
position object 4,-10,-10,-40
position object 5,-5,-10,10
position object 6,10,20,-10
position object 7,10,-5,20
position object 8,-10,10,10
set global collision on
rem The mainloop the object that will be selected will be coloured red
rem And you will see the object number in the upperleft
do
rem This for-next loop has to go from the first object to the last
rem In this case it's 1 to 4
for a=1 to 8
color object a,rgb(255,255,255)
next a
if obj>0 then color object obj,rgb(255,0,0)
text 0,0,str$(obj)
if mouseclick()=1 then obj=objsel(0)
rotate camera wrapvalue(camera angle x()+mousemovey()),wrapvalue(camera angle y()+mousemovex()),wrapvalue(camera angle z())
position mouse 320,240
sync
loop
rem The function, always call the function with objsel(0)
function objsel(obj)
if object exist(999)=0 then make object sphere 999,0.1
hide object 999
position object 999,camera position x(),camera position y(),camera position z()
rotate object 999,camera angle x(),camera angle y(),camera angle z()
for a=1 to 1000
move object 999,1
if object collision(999,0)>0
obj=object collision(999,0)
exit
endif
next a
endfunction obj
Pentium IV 2.4 GHZ 256 MB Ram Geforce 4 TI 4200 128 MB
Visit my site: www.cuso.tk