Facepunch / garrysmod-requests

Feature requests for Garry's Mod
86 stars 24 forks source link

Include Distance in TraceResult Table #2393

Closed A1steaksa closed 6 months ago

A1steaksa commented 6 months ago

It would be helpful to expose the trace's distance as one of the default values in the TraceResult table, assuming that value is already being calculated as part of the trace process.

It can be calculated, of course, but this would be a pretty simple QoL change to save boilerplate code

robotboy655 commented 6 months ago

assuming that value is already being calculated as part of the trace process.

Well it is not.

You can see what data is provided as the trace result here: https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/public/gametrace.h#L30 https://github.com/ValveSoftware/source-sdk-2013/blob/0d8dceea4310fde5706b3ce1c70609d72a38efdf/mp/src/public/trace.h#L36