Request

Response

    Autodesk.Viewing.Scene
    Version 8 preview
    This page documents a preview of the Viewer SDK v8. APIs and content can still change before the final release.

    Node3D

    Basic node type for the scene graph. Use Node3D as a transform-only parent (e.g. a joint or pivot) and InstanceNode3D for nodes that represent rendered geometry instances.

    new Node3D()

    Creates a transform-only scene graph node.

    Properties

    parent
    Node3D, null
    Parent node in the scene graph, or null for the root.
    children
    Array.<Node3D>
    Direct child nodes.
    positionLocal position relative to the parent.
    quaternionLocal rotation relative to the parent.
    scaleLocal scale relative to the parent.

    Methods

    getTransformLocal(target)

    Computes the local transform matrix for this node.

    Parameters

    targetMatrix to write into.

    Returns

    typedescription
    Matrix4 The target filled with the local matrix, or a new matrix if no target is provided.

    getTransformWorld(target)

    Reads the world transform matrix into target. If no target is provided, returns a new matrix. Subclasses (e.g. InstanceNode3D) override this to read from external storage.

    Parameters

    targetMatrix to write into.

    Returns

    typedescription
    Matrix4 The target filled with the world matrix, or a new matrix if no target is provided.

    setVisibilityState(value)

    Sets the visibility state for this node and its descendants.

    Parameters

    value*
    * Required

    getVisibilityState()

    Returns

    typedescription
    VisibilityState The visibility state.

    markDirty()

    Marks this node as needing a world matrix update. Call this after modifying position, quaternion, or scale when using dirty tracking.

    updateTransformWorld(force)

    Updates the world transform matrix for this node and its descendants. Computations are performed immediately. Subtrees with no dirty nodes are skipped.

    Parameters

    force
    boolean
    If true, forces update regardless of the dirty flag.

    isAttached()

    Returns

    typedescription
    boolean True if the node is attached to a model’s instance collection, false otherwise.

    remove(children)

    Removes the given child nodes from this node and from the instance collection.

    Parameters

    children*
    Node3D, Array.<Node3D>
    * Required

    Returns

    typedescription
    Node3D A reference to this node.

    removeFromParent()

    Removes this node from its parent and the instance collection.

    Returns

    typedescription
    Node3D A reference to this node.

    traverse(callback)

    Traverses this node and its descendants and calls the callback for each node.

    Parameters

    callback*Called once for this node and each descendant.
    * Required

    add(children)

    Adds child nodes. If a child already has a parent, it is removed from that parent first. Uninitialized children are attached to this node’s instance collection.

    Parameters

    children*
    Node3D, Array.<Node3D>
    * Required

    Returns

    typedescription
    Node3D A reference to this node.

    clear()

    Removes all children from this node.

    Returns

    typedescription
    Node3D A reference to this node.