Facepunch / garrysmod-requests

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

Add util.IntersectRayWithRay #2262

Closed wrefgtzweve closed 10 months ago

wrefgtzweve commented 10 months ago

Details

Related to https://github.com/Facepunch/garrysmod-requests/issues/2134 and https://github.com/Facepunch/garrysmod-requests/issues/1805

I was trying to replicate source engines tracer logic and noticed that IntersectRayWithRay wasn't in gmod yet image

Most other raywith functions have been added but RayWithRay seems to be missing image https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/public/collisionutils.h#L74

robotboy655 commented 10 months ago

Added as util.IsRayIntersectingRay to keep consistency between names and return values.

print(util.IsRayIntersectingRay( Vector(0,0,0), Vector(0,0,100), Vector(100,0,0), Vector(0,0,100) ))

returns bool, ray1dist, ray2dist