diff --git a/packages/engine/src/avatar/components/LoopAnimationComponent.ts b/packages/engine/src/avatar/components/LoopAnimationComponent.ts index 52a8ec3543..f7e6c86b06 100644 --- a/packages/engine/src/avatar/components/LoopAnimationComponent.ts +++ b/packages/engine/src/avatar/components/LoopAnimationComponent.ts @@ -85,7 +85,7 @@ export const LoopAnimationComponent = defineComponent({ const modelComponent = useOptionalComponent(entity, ModelComponent) - const animComponent = useComponent(entity, AnimationComponent) + const animComponent = useOptionalComponent(entity, AnimationComponent) /** * Callback functions @@ -130,14 +130,8 @@ export const LoopAnimationComponent = defineComponent({ animComponent.mixer.timeScale.set(loopAnimationComponent.animationSpeed.value) }, [loopAnimationComponent.animationSpeed]) - console.error( - modelComponent?.scene?.value, - animComponent?.animations?.value, - loopAnimationComponent?.vrm?.value, - loopAnimationComponent?.animationPack?.value - ) useEffect(() => { - if (!modelComponent?.scene?.value) return + if (!modelComponent?.scene?.value || !animComponent) return const loopComponent = getComponent(entity, LoopAnimationComponent) const animationComponent = getComponent(entity, AnimationComponent) diff --git a/packages/engine/src/avatar/functions/retargetMixamoRig.ts b/packages/engine/src/avatar/functions/retargetMixamoRig.ts index 9f1be70194..2892eed12c 100644 --- a/packages/engine/src/avatar/functions/retargetMixamoRig.ts +++ b/packages/engine/src/avatar/functions/retargetMixamoRig.ts @@ -63,8 +63,8 @@ export function retargetMixamoAnimation(clip: AnimationClip, mixamoScene: Object const leftArm = mixamoRig.getObjectByName('mixamorigLeftArm')! const userData = (vrm as any).userData - if (userData.flipped) hips.quaternion.copy(hipsOffset) - if (userData.needsMixamoPrefix) { + if (userData?.flipped) hips.quaternion.copy(hipsOffset) + if (userData?.needsMixamoPrefix) { rightArm.quaternion.copy(rightArmOffset) leftArm.quaternion.copy(leftArmOffset) }