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 an @Immutable class that represents a chain of 3D transforms applied to an element. It follows an immutable-builder pattern: every method returns a new Modifier3D instance with the requested transform applied, leaving the original unchanged. This makes Modifier3D safe to share across recompositions and to store in remember blocks. The root package exports Modifier3D as a type alias of com.elitec.spatial_compose.modifier.Modifier3D, so a single import from com.elitec.spatial_compose is sufficient.
Import
Default
Modifier3D companion object. Position is (0m, 0m, 0m), rotation is zeroed on all axes, scale is (1m, 1m, 1m), and size is null (the renderer uses its own default mesh size). Start every modifier chain from Modifier3D.Default.
Methods
position
Float arguments as metres. Internally calls the typed Distance overload with x.meters, y.meters, z.meters.
Distance values. Prefer this form when working with the spatial-units type-safe distance API.
Position along the world X axis (positive = right).
Position along the world Y axis (positive = up).
Position along the world Z axis (positive = toward the viewer in a right-handed coordinate system; use negative values to place objects in front of a camera looking down −Z).
rotateX
Rotation angle. Use the
deg or rad extension properties from spatial-units (e.g. 45f.deg).rotateY
Rotation angle. Use
45f.deg for 45 degrees, for example.rotateZ
Rotation angle.
scale
(1m, 1m, 1m). Scale and size are separate concerns: scale multiplies the mesh in object space, while size overrides the rendered bounding box dimensions.
Scale factor along the X axis.
Scale factor along the Y axis.
Scale factor along the Z axis.
size (uniform)
all distance is applied identically to width, height, and depth.
Uniform size in all three dimensions. For example,
2f.meters produces a 2 × 2 × 2 metre bounding box.size (per-axis)
Size along the X axis.
Size along the Y axis.
Size along the Z axis.
Internal Properties
These properties areinternal and not part of the public API, but they are listed here for reference when reading the source or building tooling on top of the library.
| Property | Type | Description |
|---|---|---|
position | Vec3Distance | World-space position as a typed three-component vector. |
rotation | Rotation3D | Per-axis rotation stored as a Rotation3D value. |
scale | Vec3Distance | Per-axis scale vector; defaults to (1m, 1m, 1m). |
size | Vec3Distance? | Optional explicit bounding-box size; null means the renderer uses its mesh defaults. |
Example
Each call in the chain creates a new
Modifier3D — the pattern is identical to Jetpack Compose’s own Modifier builder. Because every instance is @Immutable, you can safely remember a Modifier3D across recompositions without worrying about mutation.