Skip to content

Shapes

Isometric ships with six built-in shape geometries. Each constructor takes a position: Point as its first argument.

ShapePreviewConstructorNotes
PrismPrismPrism(position, width=1, depth=1, height=1)Rectangular box
PyramidPyramidPyramid(position, width=1, depth=1, height=1)Pyramid
CylinderCylinderCylinder(position, radius=1, height=1, vertices=20)vertices controls smoothness
OctahedronOctahedronOctahedron(position)Fixed unit size
StairsStairsStairs(position, stepCount)stepCount is required
KnotKnotKnot(position)@ExperimentalIsometricApi, known depth-sorting issues

The Shape composable renders a geometry inside an IsometricScene:

Shape(
geometry = Prism(Point.ORIGIN, width = 2.0, depth = 1.0, height = 1.5),
color = IsoColor(33, 150, 243),
position = Point(0.0, 0.0, 0.0),
rotation = 0.0,
scale = 1.0,
visible = true
)
  • geometry — one of the built-in shapes or a custom Shape
  • color — an IsoColor value (defaults to LocalDefaultColor)
  • position — world-space offset applied after geometry construction
  • rotation — rotation angle in radians
  • scale — uniform scale factor
  • visible — toggle rendering without removing the node from the tree

All transforms return a new Shape instance (shapes are immutable).

Moves a shape by the given deltas:

val box = Prism(Point.ORIGIN)
val moved = box.translate(2.0, 0.0, 1.0) // shift right and up

Scales relative to an origin point:

val box = Prism(Point.ORIGIN)
val scaled = box.scale(Point.ORIGIN, 2.0, 1.0, 0.5) // stretch X, compress Z

Rotates around the Z axis (vertical in isometric view). This is the most common rotation. rotateX and rotateY are also available.

val box = Prism(Point.ORIGIN)
val rotated = box.rotateZ(Point(0.5, 0.5, 0.0), Math.PI / 4) // 45 degrees

Shape.extrude takes a 2D Path and lifts it into a 3D solid. See the Custom Shapes guide for the full extrusion walkthrough and examples.