ok heres the code:
` Arrays used by Getpointer function to return nearest and furthest points
`Big thanks to BigDan256 who came up with the rotation maths
dim sx#(2)
dim sy#(2)
dim sz#(2)
autocam off
set display mode 1024,768,16
backdrop on
sync rate 0
sync on
load image "aim.bmp",1
color backdrop rgb(10,10,10)
make matrix 1,1000.0,1000.0,40,40
position matrix 1,-500,0,-500
make object box 2,.1,.1,1500
color object 2,rgb(255,0,0)
hide object 2
randomize timer()
`Generate random Objects for selection
for i= 20 to 50
make object box i,10,10,10
position object i,rnd(200)-100,rnd(100),rnd(200)-100
rotate object i,rnd(100),rnd(100),rnd(100)
color object i,rgb(0,255,0)
next i
hide mouse
camerax#=0
cameray#=0
cameraz#=0
cz#=-200
cy#=3
`Main Program Loop
do
sprite 1,mousex()-16,mousey()-16,1
if inkey$()="a" then cameray#=wrapvalue(cameray#-5)
if inkey$()="z" then cameray#=wrapvalue(cameray#+5)
if inkey$()="w" then camerax#=wrapvalue(camerax#-5)
if inkey$()="x" then camerax#=wrapvalue(camerax#+5)
if inkey$()="q" then cameraz#=wrapvalue(cameraz#+5)
if inkey$()="e" then cameraz#=wrapvalue(cameraz#-5)
while inkey$()<>""
endwhile
if mouseclick()=2
cy#=cy#+mousemovey()
cz#=cz#+mousemovex()
endif
position camera 0,cy#,cz#
rotate camera camerax#,cameray#,cameraz#
`Function for get near and far points from mouse pointer
getpointer()
`display nearest and furthest points
position object 2,sx#(1),sy#(1),sz#(1)
point object 2,sx#(2),sy#(2),sz#(2)
`Check for object selection
if col>0 then color object col,rgb(0,255,0)
col=object collision(2,0)
if col>0 then color object col,rgb(255,0,0)
text 0,0,"3d Object Selection Code"
text 0,15,"Written By Jason Clogg"
text 0,45,"Keyboard Controls"
text 0,60,"'w,x' Rotate camera on x axis"
text 0,75,"'a,z' Rotate camera on y axis"
text 0,90,"'q,e' Rotate camera on z axis"
sync
loop
end
`Function to find 2 points in a straight line away from the camera
function getpointer()
`set distance of nearest point
dist#=500
for i = 1 to 2
px#=(((dist#*.8)+.8)*2)/screen width()
py#=(((dist#*.6)+.6)*2)/screen height()
CAX#=camera angle x()
CAY#=camera angle y()
CAZ#=camera angle z()
CPX#=camera position x()
CPY#=camera position y()
CPZ#=camera position z()
mx#=mousex()
my#=mousey()
X1#=(mx#*px#)-((dist#*.8)+.8)
Y1#=((dist#*.6)+.6)-(my#*py#)
Z1#=dist#+1
cosCAX#=cos(CAX#)
cosCAY#=cos(CAY#)
cosCAZ#=cos(CAZ#)
sinCAX#=sin(CAX#)
sinCAY#=sin(CAY#)
sinCAZ#=sin(CAZ#)
X2#=X1#
Y2#=cosCAX#*Y1#-sinCAX#*Z1#
Z2#=SinCAX#*Y1#+CosCAX#*Z1#
`Yrotate Vector
X3#=CosCAY#*X2#+SinCAY#*Z2#
Y3#=Y2#
Z3#=CosCAY#*Z2#-SinCAY#*X2#
`Zrotate Vector
X4#=CosCAZ#*X3#-SinCAZ#*Y3#
Y4#=SinCAZ#*X3#+CosCAZ#*Y3#
Z4#=Z3#
sx#(i)=CPX#+X4#
sy#(i)=CPY#+Y4#
sz#(i)=CPZ#+Z4#
`set distance of furthest point
dist#=1000
next i
endfunction
and attached is the only image it requires