Legacy Documentation: Version 2017.2 (Go to current version)
LanguageEnglish
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

BoundsInt

struct in UnityEngine

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

Close

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

Close

Cancel

Description

Represents an axis aligned bounding box with all values as integers.

An axis-aligned bounding box, or AABB for short, is a box aligned with coordinate axes and fully enclosing some object. As the box is never rotated with respect to the axes, it can be defined by min and max points.

Properties

allPositionsWithinA BoundsInt.PositionCollection that contains all positions within the BoundsInt.
centerThe center of the bounding box.
maxThe maximal point of the box.
minThe minimal point of the box.
positionThe position of the bounding box.
sizeThe total size of the box.
xX value of the minimal point of the box.
xMaxThe maximal x point of the box.
xMinThe minimal x point of the box.
yY value of the minimal point of the box.
yMaxThe maximal y point of the box.
yMinThe minimal y point of the box.
zZ value of the minimal point of the box.
zMaxThe maximal z point of the box.
zMinThe minimal z point of the box.

Public Methods

ClampToBoundsClamps the position and size of this bounding box to the given bounds.
ContainsIs point contained in the bounding box?
SetMinMaxSets the bounds to the min and max value of the box.
ToStringReturns a nicely formatted string for the bounds.
对文档有任何疑问,请移步至开发者社区提问,我们将尽快为您解答