Area
The Area class represents an axis-aligned 3D bounding box defined by two Vec3 corners. It provides geometric operations useful for zone detection, region math, and spatial queries.
Because it is purely geometric, Area is especially useful when you need to pre-compute regions in Kotlin and then reuse the resulting coordinates in multiple commands, predicates, or generated functions.
Creating an area
Practical example
This style works well when you want a single source of truth for multiple related regions: the base area defines the layout and the derived areas stay consistent even if the original dimensions change.
Common use cases
- Define lobby, arena, checkpoint, or boss-room bounds once in Kotlin.
- Derive a slightly larger trigger zone with
expand(...). - Compute a smaller “safe interior” with
contract(...). - Test whether a point or another region belongs inside a larger gameplay area.
Function reference
| Function / Property | Description |
|---|---|
center |
Center point of the area |
contains (in) |
Check if a point or area is inside |
contract |
Shrink the area inward |
expand |
Grow the area outward |
intersect |
Intersection with another area |
move |
Translate the area by a vector |
radius |
Half-dimensions |
size |
Dimensions (x, y, z) |
union |
Union with another area |
See also
- Raycasts – Combine spatial bounds with line-of-sight checks or interaction beams.
- Entities & Players – Reuse computed areas to place, move, or query gameplay entities.
- Predicates – Turn region logic into reusable condition checks when needed.
