Language:
Discover
By Skill Level
By Category

FBox

Choose your OS:

Syntax

struct FBox

Remarks

Implements an axis-aligned box.

Boxes describe an axis-aligned extent in three dimensions. They are used for many different things in the Engine and in games, such as bounding volumes, collision detection and visibility calculation.

A bounding box. The full C++ class is located here: Engine\Source\Runtime\Core\Public\Math\Box.h

Variables

Name Description

Public variable

uint8

 

IsValid

Holds a flag indicating whether this box is valid.

Public variable

FVector

 

Max

Holds the box's maximum point.

Public variable

FVector

 

Min

Holds the box's minimum point.

Constructors

Name Description

Public function

FBox()

Default constructor (no initialization).

Public function

FBox

(
    int32
)

Creates and initializes a new box with zero extent and marks it as invalid.

Public function

FBox

(
    EForceInit
)

Creates and initializes a new box with zero extent and marks it as invalid.

Public function

FBox

(
    const TArray < FVector >& Points
)

Creates and initializes a new box from an array of points.

Public function

FBox

(
    const FVector & InMin,
    const FVector & InMax
)

Creates and initializes a new box from the specified extents.

Public function

FBox

(
    const FVector * Points,
    int32 Count
)

Creates and initializes a new box from the given set of points.

Functions

Name Description

Public function Static

FBox

 

BuildAABB

(
    const FVector & Origin,
    const FVector & Extent
)

Utility function to build an AABB from Origin and Extent

A new axis-aligned bounding box.

Public function

float

 

ComputeSquaredDistanceToPoint

(
    const FVector & Point
)

Calculates the distance of a point to this box.

The distance.

Public function

FBox

 

ExpandBy

(
    const FVector & Neg,
    const FVector & Pos
)

Increases the box size.

A new bounding box.

Public function

FBox

 

ExpandBy

(
    float W
)

Increases the box size.

A new bounding box.

Public function

FBox

 

ExpandBy

(
    const FVector & V
)

Increases the box size.

A new bounding box.

Public function

FVector

 

GetCenter()

Gets the center point of this box.

The center point.

Public function

void

 

GetCenterAndExtents

(
    FVector & center,
    FVector & Extents
)

Gets the center and extents of this box.

Public function

FVector

 

GetClosestPointTo

(
    const FVector & Point
)

Calculates the closest point on or inside the box to a given point in space.

Public function

FVector

 

GetExtent()

Gets the extents of this box.

The box extents.

Public function

const FVecto ...

 

GetExtrema

(
    int PointIndex
)

Gets a read-only reference to the specified point of the bounding box.

Public function

FVector &

 

GetExtrema

(
    int PointIndex
)

Gets a reference to the specified point of the bounding box.

A reference to the point.

Public function

FVector

 

GetSize()

Gets the size of this box.

The box size.

Public function

float

 

GetVolume()

Gets the volume of this box.

The box volume.

Public function

void

 

Init()

Set the initial values of the bounding box to Zero.

Public function

bool

 

Intersect

(
    const FBox & other
)

Checks whether the given bounding box intersects this bounding box.

Public function

bool

 

IntersectXY

(
    const FBox & Other
)

Checks whether the given bounding box intersects this bounding box in the XY plane.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FBox

 

InverseTransformBy

(
    const FTransform & M
)

Gets a bounding volume transformed by an inverted FTransform object.

Public function

bool

 

IsInside

(
    const FBox & Other
)

Checks whether a given box is fully encapsulated by this box.

true if box is inside this volume.

Public function

bool

 

IsInside

(
    const FVector & In
)

Checks whether the given location is inside this box.

true if location is inside this volume.

Public function

bool

 

IsInsideOrOn

(
    const FVector & In
)

Checks whether the given location is inside or on this box.

Public function

bool

 

IsInsideXY

(
    const FBox & Other
)

Checks whether the given box is fully encapsulated by this box in the XY plane.

Public function

bool

 

IsInsideXY

(
    const FVector & In
)

Checks whether the given location is inside this box in the XY plane.

Public function

FBox

 

MoveTo

(
    const FVector & Destination
)

Moves the center of bounding box to new destination.

A new bounding box.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FBox

 

Overlap

(
    const FBox & Other
)

Returns the overlap FBox of two box

Public function

bool

 

Serialize

(
    FArchive & Ar
)

Public function

bool

 

Serialize

(
    FStructuredArchive::FSlot Slot
)

Public function

FBox

 

ShiftBy

(
    const FVector & Offset
)

Shifts the bounding box position.

A new bounding box.

Public function

FString

 

ToString()

Get a textual representation of this box.

A string describing the box.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FBox

 

TransformBy

(
    const FMatrix & M
)

Gets a bounding volume transformed by a matrix.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FBox

 

TransformBy

(
    const FTransform & M
)

Gets a bounding volume transformed by a FTransform object.

Public function

[CORE_API](API\Runtime\Core\Misc\CORE_API_1)FBox

 

TransformProjectBy

(
    const FMatrix & ProjM
)

Transforms and projects a world bounding box to screen space

The transformed box.

Operators

Name Description

Public function

FVector &

 

operator[]

(
    int32 Index
)

Gets reference to the min or max of this bounding volume.

Public function

FBox

 

operator+

(
    const FVector & Other
)

Gets the result of addition to this bounding volume.

A new bounding volume.

Public function

FBox

 

operator+

(
    const FBox & Other
)

Gets the result of addition to this bounding volume.

A new bounding volume.

Public function

FBox &

 

operator+=

(
    const FVector & Other
)

Adds to this bounding box to include a given point.

Public function

FBox &

 

operator+=

(
    const FBox & Other
)

Adds to this bounding box to include a new bounding volume.

Public function

bool

 

operator==

(
    const FBox & Other
)

Compares two boxes for equality.

true if the boxes are equal, false otherwise.

References

Module

Core

Header

Runtime/Core/Public/Math/Box.h