Link Search Menu Expand Document

Bounds

A component that defines the pose and size of a View, i.e. its bounds within the world. Note that any changes made to the Bounds using the methods below won’t be applied (and thus visible in the world) until View:setBounds() is been run.

Constructor

 bounds = Bounds(a, b, c, w, h, d)

For convenience, a Bounds may also be created using Pose and Size objects:

 bounds = Bounds{pose=,size=}
 bounds = Bounds(pose, size)

Arguments

Name Type Description
a number The View’s x position in the world
b number The View’s y position in the world
c number The View’s z position in the world
w number The View’s width
h number The View’s height
d number The View’s depth

Returns

Nothing


Methods

bounds:copy ()

Makes a copy of a given Bounds object

Arguments

None

Returns

Type Description
Bounds A copy of the given Bounds.

bounds:moveToOrigin ()

Sets the Bounds’ Pose component to {0, 0, 0}

Arguments

None

Returns

Type Description
Bounds The updated Bounds object.

bounds:rotate (angle, x, y, z)

Rotates the Bounds around an axis.

Arguments

Name Type Description
angle number The amount to rotate the coordinate system by, in radians.
x number The x component of the axis of rotation.
y number The y component of the axis of rotation.
z number The z component of the axis of rotation.

Returns

Type Description
Bounds The updated Bounds object.

bounds:move (x, y, z)

Moves the Bounds. May be used in conjunction with Size:getEdge() to move the Bounds relative to its parent.

Arguments

Name Type Description
x number The movement along the x axis.
y number The movement along the y axis.
z number The movement along the z axis.

Returns

Type Description
Bounds The updated Bounds object.

bounds:scale (x, y, z)

Scales the Bounds.

Arguments

Name Type Description
x number The scaling along the x axis (or all axes, if y and z aren’t provided).
y number The scaling along the y axis.
z number The scaling along the z axis.

Returns

Type Description
Bounds The updated Bounds object.

bounds:inset (w, h, d)

Shrinks the Bounds by the given parameters.

Arguments

Name Type Description
w number The reduction of the component’s width.
h number The reduction of the component’s height.
d number The reduction of the component’s depth.

Returns

Type Description
Bounds The updated Bounds object.