Nodes
Nodes are the building blocks of the scene graph. Every object — mesh, light, camera — is attached to a node. Nodes form a tree via parent-child relationships.
Creating Nodes
Section titled “Creating Nodes”local node = scene:create_node("MyObject")Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
name | string | r/w | Human-readable name |
visible | bool | r/w | Whether this node is rendered (default: true) |
Transforms
Section titled “Transforms”Transforms are local (relative to parent). World transforms are computed automatically.
-- Position, rotation, scalenode.position = { x = 1, y = 2, z = 3 }node.rotation = { x = 0, y = 0, z = 0, w = 1 } -- quaternionnode.euler = { x = 0, y = 45, z = 0 } -- degrees (convenience)node.scale = { x = 1, y = 1, z = 1 }
-- Full matrix accessnode.local_transform -- mat4 (r/w), 16 floats column-majornode.world_transform -- mat4 (r/o), computed from parent chainnode.world_position -- vec3 (r/o), extracted from world transformHierarchy
Section titled “Hierarchy”node:set_parent(parent_node) -- reparent (nil = make root)node:add_child(child_node) -- add childnode:remove_child(child_node) -- remove childnode:get_parent() -- Node or nilnode:get_children() -- array of NodesAttachments
Section titled “Attachments”node:set_mesh(mesh) -- attach a Meshnode:get_mesh() -- Mesh or nilnode:set_skin(skin) -- attach a Skin (for skeletal animation)node:get_skin() -- Skin or nilCustom Properties
Section titled “Custom Properties”Store arbitrary metadata on nodes. Imported properties from FBX/glTF extras are available here.
node:set_property("layer", "foreground")node:set_property("intensity", 0.8)local v = node:get_property("layer") -- "foreground"local all = node:get_properties() -- table of all propertiesQuerying Nodes
Section titled “Querying Nodes”local all = scene:get_nodes() -- array of all nodeslocal node = scene:find_node("Head") -- by exact name, nil if not foundlocal nodes = scene:find_nodes("Light*") -- glob pattern matchDestroying Nodes
Section titled “Destroying Nodes”node:destroy() -- removes from scene graph and all children