CustomNode
fun IsometricScope.CustomNode(position: Point = Point(0.0, 0.0, 0.0), rotation: Double = 0.0, scale: Double = 1.0, rotationOrigin: Point? = null, scaleOrigin: Point? = null, visible: Boolean = true, renderOptions: RenderOptions? = null, render: (context: RenderContext, nodeId: String) -> List<RenderCommand>)
Add a custom-rendered node to the isometric scene.
This is the escape hatch for geometry beyond built-in shapes. The render function is called during tree traversal with the accumulated RenderContext and the node's unique ID (for use in RenderCommand.ownerNodeId to enable hit testing), and should return RenderCommands representing the custom geometry.
Example — a custom ground plane:
CustomNode(render = { context, nodeId ->
val groundPath = Path(
Point(-5.0, -5.0, 0.0),
Point(5.0, -5.0, 0.0),
Point(5.0, 5.0, 0.0),
Point(-5.0, 5.0, 0.0)
)
val transformedPath = context.applyTransformsToPath(groundPath)
listOf(
RenderCommand(
commandId = "ground",
points = emptyList(),
color = IsoColor(200.0, 200.0, 200.0),
originalPath = transformedPath,
originalShape = null,
ownerNodeId = nodeId
)
)
})Content copied to clipboard
Parameters
position
Local position offset
rotation
Local rotation around Z axis
scale
Local scale factor
rotationOrigin
Origin point for rotation
scaleOrigin
Origin point for scaling
visible
Whether the node is visible
renderOptions
Optional per-node render options override
render
Function producing render commands from the accumulated context and node ID