Garry's Mod Wiki

Entity:WorldSpaceAABB

  Vector, Vector Entity:WorldSpaceAABB()

Description

Returns two vectors representing the minimum and maximum extent of the entity's axis-aligned bounding box (which is calculated from entity's collision bounds.

Returns

1 Vector
The minimum vector for the entity's bounding box in world space.
2 Vector
The maximum vector for the entity's bounding box in world space.

Example

Prints Entity(1)'s maximum bounding box vector.

local min, max = Entity(1):WorldSpaceAABB() print( max )
Output: -496.828125 11730.426758 5189.393066

Example

With developer set to 1, draws the AABB of given entity using debugoverlay.

local e = Entity(123) local mi2, ma2 = e:WorldSpaceAABB() debugoverlay.Box( vector_origin, mi2, ma2, 10, Color( 255, 255, 255, 32 ) )
Output:
image.png