Documentation Index
Fetch the complete documentation index at: https://mintlify.com/danielitoCode/Spatial/llms.txt
Use this file to discover all available pages before exploring further.
Modifier3D is Spatial’s immutable transform chain — analogous to Compose’s Modifier but designed for 3D space. It is annotated @Immutable, so every operation returns a new Modifier3D instance rather than mutating the existing one. Chaining is therefore safe and composable. Under the hood, the chain is resolved into a column-major 4×4 model matrix (T × Rz × Ry × Rx × S order) before each frame is submitted to the render host.
Default
Modifier3D.Default is the zero-transform baseline — position at the world origin, no rotation, and a uniform scale of (1 m, 1 m, 1 m):
Modifier3D.Default and chain operations onto it.
Available Operations
position
Sets the element’s world-space position. Two overloads are available:
rotateX / rotateY / rotateZ
Rotates the element around the named world axis. The Angle type is constructed with the .deg extension:
scale
Multiplies the element’s size relative to its unit mesh dimensions:
size — uniform
Sets all three dimensions to the same absolute size in meters:
size — non-uniform
Sets width, height, and depth independently:
Chaining
Chain calls left-to-right, starting fromModifier3D.Default. The order follows the model matrix composition (T × Rz × Ry × Rx × S), so rotation is applied before translation:
Coordinate System
Spatial uses a standard right-handed coordinate system:| Axis | Direction |
|---|---|
| +X | Right |
| +Y | Up |
| +Z | Toward the viewer (out of the screen) |
| −Z | Into the scene (away from the viewer) |
size vs scale
size(...) | scale(...) | |
|---|---|---|
| Semantics | Sets absolute world-space dimensions in meters | Multiplies relative to the unit mesh |
| Example | .size(2f.meters) → always 2 m | .scale(2.meters, 2.meters, 2.meters) → 2× the mesh default |
| Use when | You know the exact real-world dimensions | You want proportional scaling relative to the base mesh |
size is set it overrides scale during model matrix resolution. If size is not set, scale is used instead.
Units Reference
Spatial uses two typed unit classes from thespatial-units module: