The light is created every 2 Ticks when the player was hit (I "trace" every 2 Ticks).

The light is created on the TARGET vector which is set by my "trace" function.

As you noticed, it is -not- right where your crosshiar is, but where the -hit bone- is, directed towards the shot origin.

However, you still have to crosscheck if there was a wall between the model and the shot origin.
But as this may differ quite strong from game to game I left it out.


Maybe Trace towards the shot direction with only scanning level geometry, store the result (distance) and then check if it is smaller than vec_dist(shot_origin, TARGET.X);

I could make the return value of the funtion as the distance from the shot origin to the hit position and still NULL when nothing was hit if it helps?


My project Schlacht um Kyoto - Das Samurai Browsergame! (sorry, german only)