Try using c_trace in the manual you can see:

Quote:



Modifies:
target position where the ray hits the surface of the obstacle (maybe to place a blood stain there)






So, distance = vec_dist(my.x,target);
Its just a possible implementation.