I need your helping hand with this issue I have.
Torches in Quake have no hintches, so they fit on every wall (independent to its angle).
I try to bring torches with a hintch into Quake (see below screenshot).
But that needs a specific angle of the torches, so that the hintch is facing the wall.
I try to give this workload to QC. And I am stuck

My plan is, to detect the nearest wall via qc and set the torches angle accordingly.
So that the hintch is facing the wall.
The assumption is that the walls are always upright (which is the case in 99% in Quake) to make it easier.
In all Quake maps, the distance between torch origins and walls is approx. 10 Quake units. That is always given.
So, we need only a scan around 1 z-height (which is the torches_z origin) and not a scan in 3D.
My idea is to spread out tracelines (starting at torches origin) to see where the wall is and use the trace_endpos with the smallest length as my angle direction.
That needs either many many tracelines with only lets say 5° differences around the origin, or a smarter way to do it (maybe findradius ??)
So far so good, but I could not make it work yet....
Thank you for every hint/tip you can give.
Which method I could use to make this happen.
I am using DP.
Thank you very much.