Entity:GetRotatedAABB
Description
Returns axis-aligned bounding box (AABB) of a orientated bounding box (OBB) based on entity's rotation.
Arguments
Returns
Example
The entity's AABB center (regardless of model origin) is stored in 'pos'.
local a, b = ent:GetRotatedAABB( v:OBBMins(), v:OBBMaxs() )
local pos = ( ent:GetPos() + ( a + b ) / 2 )
Output: pos has the coordinates of the AABB center.
Example
If developer
is set to 1
, displays entity's OBB and it's AABB based on entity's rotation.
The OBB can be any bounding box, not simply OBB of the model/entity.
local e = Entity( 123 )
local minsB, maxsB = e:OBBMins(), e:OBBMaxs()
local minsA, maxsA = e:GetRotatedAABB( minsB, maxsB )
-- Draw the AABB
debugoverlay.Box( e:GetPos(), minsA, maxsA, 10, Color( 255, 255, 255, 32 ) )
-- Draw the OBB
debugoverlay.BoxAngles( e:GetPos(), minsB, maxsB, e:GetAngles(), 10, Color( 255, 0, 255, 32 ) )