Node class base

A Node represents a single element in a 3D scene graph.

Each node can contain a transform (position, rotation, scale), a mesh (3D geometry and material), and child nodes. Nodes are used to build complex scenes by establishing relationships between different elements, allowing for transformations to propagate down the hierarchy.

Implemented types

Constructors

Node({String name = '', Matrix4? localTransform, Mesh? mesh})
Creates a node with an optional name, localTransform, and mesh.

Properties

children List<Node>
This list allows the node to act as a parent in the scene graph hierarchy. Transformations applied to this node, such as translation, rotation, and scaling, will also affect all child nodes.
final
combinedLocalBounds → Aabb3?
Local-space AABB covering this node's mesh and every descendant's (transformed) bounds. Returns null when the subtree contains skinned content or geometry without computable bounds, signalling "treat as always visible." Cached; invalidated by markBoundsDirty.
no setter
excludeFromWindingParity bool
When true, this node's own transform is treated as a coordinate-system convention rather than a geometry mirror, and excluded from windingFlipped. The importers set this on the synthesized scene root that flips glTF's handedness (scale(1, 1, -1)), so that flip does not reverse cull winding the way a real mirror node should.
getter/setter pair
frustumCulled bool
Whether this node and its descendants should be tested against the camera frustum each frame. When true (the default), subtrees whose combinedLocalBounds don't intersect the frustum are skipped entirely. Set to false for procedural geometry, large terrain pieces, or anything else where the cached bound is known-stale or known-misleading.
getter/setter pair
globalTransform ↔ Matrix4
The world-space transform of this node, with every ancestor's transform applied.
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
isJoint bool
Whether this node is a joint in a skeleton for animation.
getter/setter pair
localTransform ↔ Matrix4
The transform of this node relative to its parent: position, rotation, and scale.
getter/setter pair
mesh Mesh?
The collection of MeshPrimitive objects that represent the 3D geometry and material properties of this node.
getter/setter pair
name String
The name of this node, used for identification.
getter/setter pair
parent Node?
The parent node of this node in the scene graph.
no setter
parsedAnimations List<Animation>
The list of animations parsed when this node was deserialized.
no setter
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
skin Skin?
The skin attached to this node, used for skeletal animation. Set by importers (both the offline .model path and the runtime glTF/GLB loader).
getter/setter pair
visible bool
Whether this node is visible in the scene. If false, the node and its children will not be rendered.
getter/setter pair
windingFlipped bool
Whether this node's accumulated transform reverses triangle winding (a mirror / negative scale somewhere up the chain). The renderer flips cull winding for such nodes so their front faces are not culled.
no setter

Methods

add(Node child) → void
Add a child node.
override
addAll(Iterable<Node> children) → void
Add a list of child nodes.
override
addComponent(Component component) → void
Attaches component to this node.
addMesh(Mesh mesh) → void
Add a mesh as a child node.
override
addParsedAnimation(Animation animation) → void
Append to the parsed animation list. Used by importers (including the runtime glTF/GLB loader).
clone({bool recursive = true}) Node
Creates a copy of this node.
createAnimationClip(Animation animation) AnimationClip
Instantiates animation as an AnimationClip bound to this node.
debugPrintHierarchy({int depth = 0}) → void
Prints the hierarchy of this node and all its children to the console.
detach() → void
Detaches this node from its parent in the scene graph.
findAnimationByName(String name) Animation?
Searches for an Animation by name.
getChildByIndexPath(Iterable<int> indexPath) Node?
Resolves an indexPath (as produced by getIndexPath) to a descendant node, or null if any segment is out of range.
getChildByName(String name, {bool excludeAnimationPlayers = false}) Node?
Searches this node's descendants for the first child whose Node.name matches name.
getChildByNamePath(Iterable<String> namePath) Node?
Resolves a namePath (as produced by getNamePath) to a descendant node, or null if any segment does not match.
getComponent<T>() → T?
Returns the first attached component of type T, or null.
getComponents<T>() Iterable<T>
Returns every attached component of type T, in attach order.
getDepth() int
Returns the depth of this node in the scene graph hierarchy. The root node has a depth of 0.
getRoot() Node
Returns the root node of the graph that this node is a part of.
isVisibleTo(Camera camera, Size dimensions) bool
Whether this node's subtree would survive frustum culling against camera for a render target of the given dimensions.
markBoundsDirty() → void
Mark this node's combinedLocalBounds cache (and every ancestor's) stale. Call after replacing a mesh, mutating a child's local transform in place, or any other change that affects the bound.
markTransformDirty() → void
Marks this node's transform changed: its own and its descendants' cached world transforms become stale, and its own and its ancestors' cached bounds become stale.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
registerAsRoot(Scene scene) → void
Registers this node as the root node of the scene graph.
remove(Node child) → void
Remove a child node.
override
removeAll() → void
Remove all children nodes.
override
removeComponent(Component component) → void
Detaches component from this node.
scenePrePass(double deltaSeconds, [bool ancestorsVisible = true]) → void
Walks this node's subtree once per frame to prepare it for rendering: ticks components and animation players and refreshes the RenderItems the render passes iterate.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

fromAsset(String assetPath) Future<Node>
The asset file should be in a format that can be converted to a scene graph node.
fromFlatbuffer(ByteData byteData) Future<Node>
Deserialize a model from Flutter Scene's compact model format.
fromGlbAsset(String assetPath) Future<Node>
Convenience wrapper for fromGlbBytes that loads from the asset bundle.
fromGlbBytes(Uint8List bytes) Future<Node>
Load a glTF binary (GLB) model directly from raw bytes.
fromGltfBytes(Uint8List gltfJson, {required GltfResourceResolver resolveUri}) Future<Node>
Load a multi-file glTF model from the raw bytes of its .gltf (JSON) file.
getIndexPath(Node ancestor, Node child) Iterable<int>?
Returns the sequence of child indices that walks from ancestor down to child through the scene graph.
getNamePath(Node ancestor, Node child) Iterable<String>?
Returns the sequence of Node.name values that walks from ancestor down to child through the scene graph.