Created
June 27, 2022 22:02
-
-
Save JacobMuchow/8d3260247fc14e77c0e355bbeafe6474 to your computer and use it in GitHub Desktop.
three.js morph target utility
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const object3DChildNamed = (object, name, { recursive = false } = {}) | |
if (!recursive) { | |
return object.children.find(child => child.name === name) | |
} | |
for (const child of object.children) { | |
if (child.name === name) return child | |
if (child.children.length > 0) { | |
const found = object3DChildNamed(child, name, { recursive }) | |
if (found) return found | |
} | |
} | |
return undefined | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment