@woosh/meep-engine
Version:
Pure JavaScript game engine. Fully featured and production ready.
19 lines (15 loc) • 434 B
JavaScript
/**
*
* @param {THREE.Object3D} object
* @param {function(THREE.Object3D)} visitor
* @param {*} [thisArg]
*/
export function traverseThreeObject(object, visitor, thisArg) {
visitor.call(thisArg, object);
const children = object.children;
const n = children.length;
for (let i = 0; i < n; i++) {
const child = children[i];
traverseThreeObject(child, visitor, thisArg);
}
}