traverseVisible method

void traverseVisible(
  1. dynamic callback(
    1. Object3D?
    )
)

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

Like traverse, but the callback will only be executed for visible objects. Descendants of invisible objects are not traversed.

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

Implementation

void traverseVisible(Function(Object3D?) callback) {
  if (visible == false) return;

  callback(this);

  final children = this.children;

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