Math Obb
scripts/vscripts/alyxlib/math/obb.lua
Functions
GetBoundingOBBData
Returns the center and half extents of an OBB in local space.
Parameters
mins
Vector
The local space minimum cornermaxs
Vector
The local space maximum corner
Returns
- OBBData
The OBB data
GetEntityOBBData
Returns the center and half extents of an entity's OBB in local space.
Parameters
entity
EntityHandle
The entity to get the OBB data for
Returns
- OBBData
The OBB data
GetEntityAABB
Returns the world space minimum and maximum corners of an entity's OBB.
Parameters
entity
EntityHandle
The entity to get the AABB for
Returns
Vector
The world space minimum corner
Vector
The world space maximum corner
AABBvsAABB
Tests if two AABBs intersect.
Parameters
aMin
Vector
The minimum corner of the first AABBaMax
Vector
The maximum corner of the first AABBbMin
Vector
The minimum corner of the second AABBbMax
Vector
The maximum corner of the second AABB
Returns
- boolean
true if the AABBs intersect, false otherwise
OBBvsOBB
Tests if two OBBs intersect.
Parameters
obbDataA
OBBData
The data of the first OBBoriginA
Vector
The world space origin of the first OBBanglesA
QAngle
The angles of the first OBBobbDataB
OBBData
The data of the second OBBoriginB
Vector
The world space origin of the second OBBanglesB
QAngle
The angles of the second OBB
Returns
- boolean
true if the OBBs intersect, false otherwise
AABBvsOBB
Tests if an AABB and an OBB intersect.
Parameters
aabbMin
Vector
The minimum corner of the AABBaabbMax
Vector
The maximum corner of the AABBobbData
OBBData
The data of the OBBobbOrigin
Vector
The world space origin of the OBBobbAngles
QAngle
The angles of the OBB
Returns
- boolean
true if the AABB and OBB intersect, false otherwise
PointInAABB
Tests if a point is inside an AABB.
Parameters
aMin
Vector
The minimum corner of the AABBaMax
Vector
The maximum corner of the AABBpoint
Vector
The point to test
Returns
- boolean
true if the point is inside the AABB, false otherwise
PointInOBB
Tests if a point is inside an OBB.
Parameters
obbData
OBBData
The OBB data (center, half extents in local space)origin
Vector
The world space origin of the OBBangles
QAngle
The world space orientation of the OBBpoint
Vector
The point to test
Returns
- boolean
true if the point is inside the OBB, false otherwise
DebugDrawOBB
Draws an OBB in the world.
Parameters
obbData
OBBData
The data of the OBBorigin
Vector
The world space origin of the OBBangles
QAngle
The angles of the OBBcolor
Vector
The color of the OBBnoDepthTest
boolean
True if the OBB should be drawn above all geometryseconds
number
The number of seconds the OBB should be visible for
DebugDrawEntityOBB
Draws an entity's OBB in the world.
Parameters
entity
EntityHandle
The entity to draw the OBB forcolor
Vector
The color of the OBB in RGBnoDepthTest
boolean
True if the OBB should be drawn above all geometryseconds
number
The number of seconds the OBB should be visible for
DebugDrawEntityAABB
Draws an entity's AABB in the world.
The AABB is defined by the entity's bounding mins/maxs and its current origin/angles.
Parameters
entity
EntityHandle
The entity to draw the AABB forcolor
Vector
The color of the AABB in RGBnoDepthTest
boolean
True if the AABB should be drawn above all geometryseconds
number
The number of seconds the AABB should be visible for