Garry's Mod Wiki

Revision Difference

util.IntersectRayWithPlane#568259

<function name="IntersectRayWithPlane" parent="util" type="libraryfunc"> <description>Performs a [ray-plane intersection](https://en.wikipedia.org/wiki/Line%E2%80%93plane_intersection) and returns the hit position or nil.</description> <realm>Shared</realm> <args> <arg name="rayOrigin" type="Vector">Origin/start position of the ray.</arg> <arg name="rayDirection" type="Vector">The direction of the ray.</arg> <arg name="planePosition" type="Vector">Any position of the plane.</arg> <arg name="planeNormal" type="Vector">The normal vector of the plane.</arg> </args> <rets> <ret name="" type="Vector">The position of intersection, nil if not hit.</ret> <ret name="" type="Vector">The position of intersection, `nil` if not hit.</ret> <ret name="" type="number" added="2026.07.17">The distance from start position to the hit point, if there was a hit.</ret>⤶ </rets> </function>