SceneNode class
A declarative Node: a transform in the scene graph, described in
build().
The widget owns a retained engine Node; rebuilding with changed
properties applies only the differences, and removing the widget detaches
the node. Give it children to describe a subtree, components for
engine-side behavior, and a controller for imperative access.
Provide the transform either decomposed (position, rotation, scale)
or as a full transform matrix, not both. Transform props are treated as
immutable values; do not mutate a vector after passing it (pass a new one
instead). For motion every frame, prefer a Component or a
SceneNodeController over rebuilding, so no widgets rebuild per frame.
SceneNode(
position: Vector3(0, 1, 0),
components: [SpinComponent()],
children: [SceneMesh(geometry: geometry, material: material)],
)
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatefulWidget
- SceneNode
Constructors
Properties
-
children
→ List<
Widget> -
Scene widgets describing this node's children.
finalinherited
-
components
→ List<
Component> -
Engine-side behavior attached to the node. Diffed by identity: keep a
component instance stable across rebuilds to keep its state.
finalinherited
- controller → SceneNodeController?
-
Imperative handle to the managed node.
finalinherited
- hashCode → int
-
The hash code for this object.
no setterinherited
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- name → String?
-
The node's name, for lookups and debugging. Defaults to ''.
finalinherited
- position → Vector3?
-
Local translation. Identity when null.
finalinherited
- rotation → Quaternion?
-
Local rotation. Identity when null.
finalinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- scale → Vector3?
-
Local scale. One when null.
finalinherited
- transform → Matrix4?
-
Full local transform. Mutually exclusive with the decomposed props.
finalinherited
- visible → bool
-
Whether the node (and its subtree) renders.
finalinherited
Methods
-
createElement(
) → StatefulElement -
Creates a StatefulElement to manage this widget's location in the tree.
inherited
-
createState(
) → State< SceneNode> -
Creates the mutable state for this widget at a given location in the tree.
override
-
debugDescribeChildren(
) → List< DiagnosticsNode> -
Returns a list of DiagnosticsNode objects describing this node's
children.
inherited
-
debugFillProperties(
DiagnosticPropertiesBuilder properties) → void -
Add additional properties associated with the node.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toDiagnosticsNode(
{String? name, DiagnosticsTreeStyle? style}) → DiagnosticsNode -
Returns a debug representation of the object that is used by debugging
tools and by DiagnosticsNode.toStringDeep.
inherited
-
toString(
{DiagnosticLevel minLevel = DiagnosticLevel.info}) → String -
A string representation of this object.
inherited
-
toStringDeep(
{String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug, int wrapWidth = 65}) → String -
Returns a string representation of this node and its descendants.
inherited
-
toStringShallow(
{String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) → String -
Returns a one-line detailed description of the object.
inherited
-
toStringShort(
) → String -
A short, textual description of this widget.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited