As a variant, you can try to trace from gun to your target coordinates in 3d, then find place, where your bullet will collide with obstacle and then place crosshair picture there.
I was told about another variant [clickeable]
1st prize: Lite-C and Newton 2.17 by Vasilenko Vitaliy