Default behavior color
PrivateentityThe position of the rectangle's top-left corner (or center, depending on LEA's origin convention).
This is a live reference to a LEA.Vector2 instance.
Mutating .x, .y,
Using Vector2 methods (.add(), .sub(), .scale(), etc.) will NEVER mutate the vector unless the .override(x, y)
immediately updates the entity's position without causing a component refresh.
X-coordinate of the rectangle (alias for pos.x).
Writing to this property immediately updates pos.x.
Y-coordinate of the rectangle (alias for pos.y).
Writing to this property immediately updates pos.y.
Width of the rectangle (affects collision & rendering bounds).
Height of the rectangle (affects collision & rendering bounds).
Left edge of the rectangle from pos.x and width.
Writing to this property immediately updates the used properties.
Right edge of the rectangle from pos.x and width.
Writing to this property immediately updates the used properties.
Top edge (flipped Y) of the rectangle from pos.y and height.
Writing to this property immediately updates the used properties.
Top edge (flipped Y) of the rectangle from pos.y and height.
Writing to this property immediately updates the used properties.
Checks whether this rectangle is currently colliding (overlapping or touching) with another rectangle.
Uses axis-aligned bounding box (AABB) collision detection — very fast and suitable for most 2D games.
Important:
pos, width, height values (no rotation support by default).false if either entity is missing or not yet mounted.true if the rectangles overlap or touch, false otherwise
const playerRect = useRect();
const enemyRect = otherEnemy.exportsRef.current?.rect; // assuming exported via useExports
useTick(dt => {
// move player...
if (enemyRect && playerRect.isCollidingWith(enemyRect)) {
// take damage, play sound, etc.
playerRect.z = 999; // visual feedback: bring to front
}
});
LEA.RectLeaEntity.isCollidingWith — the underlying LEA implementation
A convenient facade for the rectangle entity associated with the current Kayla component.
Provides direct, mutable access to position, size and basic properties of the underlying LEA.RectLeaEntity. Most properties are getters/setters that forward to the internal entity.
Important notes:
posis a live reference to a LEA.Vector2 instance — mutating it (.x,.y,.add(...), etc.) directly affects the entity's position without triggering a component refresh.width/heightaffects collision & drawing bounds.zcontrols draw order (higher = drawn later / on top).Example