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})

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
globalTransform ↔ Matrix4
The transformation matrix representing the node's position, rotation, and scale in world space.
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 transformation matrix representing the node's position, rotation, and scale relative to the parent node.
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
visible bool
Whether this node is visible in the scene. If false, the node and its children will not be rendered.
getter/setter pair

Methods

add(Node child) → void
Add a child node.
override
addAll(Iterable<Node> children) → void
Add a list of child nodes.
override
addMesh(Mesh mesh) → void
Add a mesh as a child node.
override
clone({bool recursive = true}) Node
Creates a copy of this node.
createAnimationClip(Animation animation) AnimationClip
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?
Returns the child node at the specified index path.
getChildByName(String name, {bool excludeAnimationPlayers = false}) Node?
getChildByNamePath(Iterable<String> namePath) Node?
Returns the child node at the specified name path.
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.
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
render(SceneEncoder encoder, Matrix4 parentWorldTransform) → void
Recursively records Mesh draw operations for this node and all its children.
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.
getIndexPath(Node ancestor, Node child) Iterable<int>?
Returns the index lookup path from the ancestor node to the child node.
getNamePath(Node ancestor, Node child) Iterable<String>?
Returns the name lookup path from the ancestor node to the child node.