I created a camera with an 1*1 image which renders the screen, with a shader which renders all the shootable objects in green.
Now this 1ps*1px image is pasted on the bottom right corner of the screen.
Now I use the POiNT() command to get the color of this pixel.
This pixel is only visible, if you really shoot, otherwise it will not be visible.
The code itself is not 100% perfect, as I need to get the camera position z(ColCam) better, as the object gets a bit smaller if its far away, so I need to calculate this to get the camera as near as possible to the object.
Here I give you the code snippet of the camera creation and update, the rest should be easy to understand!
MakeColCam:
global ColCam
if Rays=1 and Bloom=1 then ColCam=5
if Rays=0 and Bloom=1 then ColCam=4
if Rays=1 and Bloom=0 then ColCam=2
if Rays=0 and Bloom=0 then ColCam=1
make camera ColCam
set camera aspect ColCam,(Sw_def#/Sh_def#)
set camera to image ColCam,60,1,1//Sw_def#,Sh_def#
set camera range ColCam,3,100000
set camera fov ColCam,20
return
Function UpdateColCam(objpos#,realobj,zpos#)
clocampickdist#=get pick distance()
pick screen mousex(),mousey(),clocampickdist#
colcampickx#=get pick vector x()
colcampicky#=get pick vector y()
colcampickz#=get pick vector z()
center text screen width()/2,45,"CameraPos "+str$(objpos#)+" \ "+str$(camera position z(0))
if realobj=1
position camera ColCam,colcampickx#+camera position x(0),colcampicky#+camera position y(0),zpos#-8.2//camera position z(0)-(camera position z(0)-objpos#)
//point camera ColCam,camera position x(0)+colcampickx#,camera position y(0)+colcampicky#,camera position z(0)+colcampickz#
else
position camera ColCam,camera position x(),camera position y(),camera position z()
//point camera ColCam,colcampickx#,colcampicky#,colcampickz#
endif
endfunction
... efxMod Developer!