Garry's Mod Wiki

util.IntersectRayWithOBB

Vector, Vector, number util.IntersectRayWithOBB( Vector rayStart, Vector rayDelta, Vector boxOrigin, Angle boxAngles, Vector boxMins, Vector boxMaxs )

Description

Performs a "ray" box intersection and returns position, normal and the fraction.

Arguments

1 Vector rayStart
Origin/start position of the ray.
2 Vector rayDelta
The ray vector itself. This can be thought of as: the ray end point relative to the start point.

Note that in this implementation, the ray is not infinite - it's only a segment.

3 Vector boxOrigin
The center of the box.
4 Angle boxAngles
The angles of the box.
5 Vector boxMins
The min position of the box.
6 Vector boxMaxs
The max position of the box.

Returns

1 Vector
Hit position, nil if not hit.
2 Vector
Normal/direction vector, nil if not hit.
3 number
Fraction of trace used, nil if not hit.

Page Links


Special Pages


Wikis

?

Render Time: 50ms

Session 0
DB GetPage 4
Generate Html 25
SaveChanges 8
Render Body 0
Render Sidebar 12