• Searches for a given component type in the children of the given object.

    Type Parameters

    Parameters

    • obj: Object3D<Object3DEventMap>

      The object to start the search from - this object is also included in the search.

    • componentType: Constructor<T>

      The type of the component to search for.

    • Optionalarr: null | T[]

      An optional array to store the found components in. If not provided, a new array is created.

    • clearArray: boolean = true

      If true, the array is cleared before storing the found components. Default is true.

    Returns T[]

    An array of components of the given type found in the children of the given object.

    const myComponents = getComponents(myObject, MyComponent);