mylingo3d
Version:
Lingo3D is a React/Vue 3d game development framework that ships with a complete visual editor
25 lines (21 loc) • 696 B
text/typescript
import { Cancellable } from "@lincode/promiselikes"
import { createEffect } from "@lincode/reactivity"
import { Bone as ThreeBone } from "three"
import { getRetargetBones } from "../../states/useRetargetBones"
createEffect(() => {
const dummy = getRetargetBones()
if (!dummy) return
const handle = new Cancellable()
handle.watch(
dummy.loaded.then((loadedGroup) => {
const bone = loadedGroup.getObjectByProperty(
"type",
"Bone"
) as ThreeBone
bone.traverse((parent) => (parent.name = "mixamorig" + parent.name))
})
)
return () => {
handle.cancel()
}
}, [getRetargetBones])