Skip to main content

Function: traverseUtil()

traverseUtil(node, callback): boolean

Defined in: src/utils/SceneGraphUtils.ts:51

Traverses the scene graph from a given node, calling a callback function for each node. The traversal stops if the callback returns true.

This function is similar to THREE.Object3D.traverse, but allows for early exit from the traversal based on the callback's return value.

Parameters

node

Object3D

The starting node for the traversal.

callback

(node) => boolean

The function to call for each node. It receives the current node as an argument. If the callback returns true, the traversal will stop.

Returns

boolean

Whether the callback returned true for any node.