Skip to main content
Nodes are the fundamental building blocks of your 3D scene. This guide shows you how to create walls, slabs, zones, and items programmatically.

Understanding Node Creation

All nodes are created using useScene.getState().createNode(). Each node type has its own schema definition that validates the data structure.
Nodes automatically appear in the 3D scene when created. The SDK handles registering them in the scene graph and making them visible.

Creating Nodes Step-by-Step

1

Import the required schemas

First, import the node schemas and the scene store:
2

Get the parent ID

Most nodes need a parent. Typically, walls, slabs, zones, and items are children of a Level:
3

Create the node data

Use the schema’s .parse() method to validate and create the node:
4

Add the node to the scene

Call createNode() with the node data and parent ID:
The node will immediately appear in the 3D scene and be registered in the scene graph.

Parent-Child Relationships

Nodes form a hierarchy through the parentId property. Understanding this structure is crucial:
When an item is placed on another item’s surface, its position is relative to the parent item’s coordinate system.

Wall-Attached Items

Items can attach to walls using the attachTo property:
For wall-attached items:
  • position[0] is the distance from the wall start point
  • position[1] is the height from the floor
  • The item will snap to the specified wall side

Batch Node Creation

Create multiple nodes efficiently using createNodes():

Node Visibility

All nodes have a visible property that controls their visibility in the 3D scene:
Invisible nodes still participate in spatial queries and collision detection. They’re only hidden visually.

Common Patterns

Creating a Room with Furniture

Next Steps

Event Handling

Learn how to respond to user interactions with nodes

Spatial Queries

Validate placement and perform collision detection