@shopware-ag/dive
Version:
Shopware Spatial Framework
17 lines (14 loc) • 410 B
text/typescript
import { type Object3D } from 'three';
import { type DIVEScene } from '../../scene/Scene';
/**
* Find the scene object of an object.
*
* @param object - The object to find the scene of.
* @returns The scene object.
*/
export const findSceneRecursive = (object: Object3D): DIVEScene => {
if (object.parent) {
return findSceneRecursive(object.parent);
}
return object as DIVEScene;
};