• Performs a BFS on a collection of root objects and their descendants. It uses a predicate function to determine if an object in the scene graph meets certain conditions.

    Type Parameters

    • T

    Parameters

    • rootObjects: SceneObject[]

      The root objects to start the BFS from.

    • predicate: ((sceneObject: SceneObject) => T)

      The predicate function to call on each object. This function should take a SceneObject as an argument and return a boolean. If the function returns true for an object, that object is immediately returned by the BFS function. If it returns false, the search continues to the next object.

    Returns T | null

    the object returned by the predicate function, otherwise null.