util.IntersectRayWithTriangle
Vector, number util.IntersectRayWithTriangle( Vector rayOrigin, Vector rayEnd, Vector triA, Vector triB, Vector triC, boolean oneSided = false )
Recently Added
This was recently added in version (2026.07.16). It might only be available on the Dev Branch right now.
Description
Performs a ray-triangle intersection and returns the hit position or nil.
Arguments
6 boolean oneSided = false
Whether the triangle can be hit from only one side (
true) or from both sides (false).
This assumes clockwise vertex arrangement to determine the "hittable" side.
Returns
Example
Output: 

Garry's Mod
Rust
Steamworks
Wiki Help