← Back to 2D Structs
Rect2
⚠️ Experimental - Pre-Release
Rect2 represents a 2D rectangle with position and size. Used for defining rectangular areas, bounding boxes, and UI regions.
Fields
x: float
The x position of the rectangle.
y: float
The y position of the rectangle.
w: float
The width of the rectangle.
h: float
The height of the rectangle.
Usage Example
@script MyNode extends Node2D fn init() { // Create a rectangle at (10, 20) with size 100x50 var rect = new Rect2(10.0, 20.0, 100.0, 50.0) // Access rectangle properties Console.print("Rect position: " + rect.x + ", " + rect.y) Console.print("Rect size: " + rect.w + "x" + rect.h) }Related
- Vector2- 2D vector for positions
- All 2D Structs
