traverse method

void traverse(
  1. dynamic callback(
    1. Object3D
    )
)

callback - A function with as first argument an object3D object.

Executes the callback on this object and all descendants.

Note: Modifying the scene graph inside the callback is discouraged.

Implementation

void traverse(Function(Object3D) callback) {
  callback(this);

  final children = this.children;

  for (int i = 0, l = children.length; i < l; i++) {
    children[i].traverse(callback);
  }
}