another way would to be to store the bullets coordinates before moving it, then move it then you could use
SC_rayCast(0,oldX#,oldY#,oldZ#,newX#,newY#,newZ#,2)
as for detecting what was actually shot, you should group the objects accordingly (ex: group 1=level objects, 2=enemies etc...), then you can run multiple raycasts for each object group ex:
hit=SC_rayCast(0,oldX#,oldY#,oldZ#,newX#,newY#,newZ#,2)
if hit
ShotLevel=SC_rayCast(1,oldX#,oldY#,oldZ#,newX#,newY#,newZ#,0)
ShotEnemy=SC_rayCast(2,oldX#,oldY#,oldZ#,newX#,newY#,newZ#,0)
if ShotLevel then place decal (bullet hole)
if ShotEnemy then hurt enemy
endif
the first raycast isn't really necessary, but will prevent performing multiple raycasts when no object has been hit. I have changed the exclude object parameter to 0 assuming that your object number 2 Isn't a part of either group.