traverseAncestors method

void traverseAncestors(
  1. dynamic callback(
    1. Object3D?
    )
)
inherited

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

Executes the callback on all ancestors.

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

Implementation

void traverseAncestors(Function(Object3D?) callback) {
  final parent = this.parent;

  if (parent != null) {
    callback(parent);

    parent.traverseAncestors(callback);
  }
}