Bonjour, ça va bien? Je suis holandais. Je ne parle pas Francais bien...
I understand what you said
. This is the object selection code with your code included(kind of), thank you very much!!! The only thing that needs fixing is the corner thingie. Maybe you know a solution. But it's much better than first now, merci beaucoup.
rem ---3D camera rotation---
rem RTSpider with great help from Attreid
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
fovy# = 38.6598
fovx# = 31
make object sphere 999,0.1
hide object 999
set object rotation zyx 999
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 8
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)
if leftkey()=1 then yrotate camera wrapvalue(camera angle y()-1)
if rightkey()=1 then yrotate camera wrapvalue(camera angle y()+1)
if upkey()=1 then xrotate camera wrapvalue(camera angle x()-1)
if downkey()=1 then xrotate camera wrapvalue(camera angle x()+1)
sx# = mousemovex()
sy# = mousemovey()
anglex# = anglex# + (sy#/10)
angley# = angley# + (sx#/10)
if angley# < 0-fovy# then angley# = 0-fovy#
if anglex# < 0-fovx# then anglex# = 0-fovx#
if angley# > fovy# then angley# = fovy#
if anglex# > fovx# then anglex# = fovx#
show object 999
position object 999,camera position x(),camera position y(),camera position z()
xrotate object 999,wrapvalue(camera angle x()+anglex#)
yrotate object 999,wrapvalue(camera angle y()+angley#)
move object 999,10
rotate object 999,camera angle x(),camera angle y(),camera angle z()
move object 999,-10
xrotate object 999,wrapvalue(camera angle x()+anglex#)
yrotate object 999,wrapvalue(camera angle y()+angley#)
sync
loop
rem The function, always call the function with objsel(0)
function objsel(obj)
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