Health/Damage Swept Pill Tracing
Added 2023-04-24 23:57:56 +0000 UTCEDIT: Make sure you also read my later realization about this system, heh
You maybe saw that trace call in my damage tracer and wondered, what the heck is that?
Easy! It's the function I use to trace SWORDS, by treating them as a bunch of swept spheres, and I place those spheres along the sword by stepping between a couple of sockets that market the start and end points of the live blade.

It looks big, but really it's pretty straightforward,

I just start by laying out the line of the blade, how long it is, and how I'm going to step along it iteratively. Remember that what I've got here is 4 values: the start and end points of the blade, both last frame and this frame. So I'm gonna do a bunch of sphere traces to span that distance and see if the sword hit anything.

This is where the rubber meets the road, but really it's just simple math. Step along line by fixed amount per step, do trace from there to same relative point on the "destination" line, see if hit anything, save if so.
The fanciest bit is that you gotta remember to exclude Actors as you go, since you probably don't want to hit the same actor a bunch of times with what's meant to be, logically, a single "trace". Functionally this means that the hit point returned will be the point closest to the hilt of the sword, since we trace from that end to the tip of the sword. Maybe that's useful or interesting in practice? But it probably at least doesn't matter.
So anyways yeah! Behold the fake swept cylinder trace. WOO.