Luduvo Contents
Theme
On this page

Rect

an axis-aligned rectangle, from its minimum corner to its maximum corner

Fields

4 members

Height: number

height of the rectangle along the vertical axis

Max: vector

maximum corner coordinates

Min: vector

minimum corner coordinates

Width: number

width of the rectangle along the horizontal axis

Constructing 2D Bounding Rectangles

Lifecycle: Shared

A rect stores two corners and derives its width and height from them.

Luau
local minPoint = Vector2.new(10, 20)local maxPoint = Vector2.new(210, 120)local bounds = Rect.new(minPoint, maxPoint)local width = bounds.Widthlocal height = bounds.Heightprint(string.format("Rectangle dimensions: %d x %d", width, height))