Don't use the distance but the
if(trace_hit) ...
variable (or the hit macro, manual: hit and c_trace obviously).
Obviously you want to either c_ignore both player and enemy (or IGNORE_ME and IGNORE_PASSABLE and let's say set the player to passable immediately before the trace and reset the flag after).


"Falls das Resultat nicht einfach nur dermassen gut aussieht, sollten Sie nochmal von vorn anfangen..." - Manual

Check out my new game: Pogostuck: Rage With Your Friends