-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Description
I want to use the actions in the Animation.glb file to move the models in the Body and Clothes files
When there is a model in jsx, there is no problem playing the action; When there are two models in jsx, only the model rendered above is active
Please take a look at it for me. Thank you
const [
{ nodes: bnodes, materials: bmaterials, animations: bAnimations },
{ nodes: cnodes, materials: cmaterials, animations: cAnimations },
{ materials: faceMaterials },
{ animations: allAnimations },
] = useGLTF([
'https://m.xiwang.com/resource/__private__/9fc88cd3ce9ac8d30e46cd3c5287d090/du-glb/Body1.glb',
'https://m.xiwang.com/resource/__private__/9fc88cd3ce9ac8d30e46cd3c5287d090/du-glb/Clothes1.glb',
'https://m.xiwang.com/resource/__private__/9fc88cd3ce9ac8d30e46cd3c5287d090/du-glb/Face2-draco.glb',
'https://m.xiwang.com/resource/__private__/9fc88cd3ce9ac8d30e46cd3c5287d090/du-glb/Animation.glb'
]);
const { actions: allActions, names: allNames} = useAnimations(allAnimations, houRef)
const currentAction = allActions[allNames[index]];
currentAction.reset().setLoop(THREE.LoopOnce, 1).fadeIn(0.5).play()
return (
<group ref={houRef} dispose={null} onClick={handleModelClick}>
<primitive object={bnodes.root_refx} />
<primitive object={bnodes.c_pos} />
<primitive object={bnodes.c_arms_polel} />
<primitive object={bnodes.c_arms_poler} />
<primitive object={bnodes.c_foot_ikr} />
<primitive object={bnodes.c_leg_poler} />
<primitive object={bnodes.c_foot_ikl} />
<primitive object={bnodes.c_leg_polel} />
<primitive object={bnodes.c_hand_ikr} />
<primitive object={bnodes.c_hand_ikl} />
<primitive object={cnodes.c_pos} />
<primitive object={cnodes.c_arms_polel} />
<primitive object={cnodes.c_arms_poler} />
<primitive object={cnodes.c_foot_ikr} />
<primitive object={cnodes.c_leg_poler} />
<primitive object={cnodes.c_foot_ikl} />
<primitive object={cnodes.c_leg_polel} />
<primitive object={cnodes.c_hand_ikr} />
<primitive object={cnodes.c_hand_ikl} />
<primitive object={cloneSkeleton(bnodes.root_refx)} />
{showMesh?.map((item) => (
<React.Fragment key={item.skuId}>{BODYS_LIST[item.skuId]}</React.Fragment>
))}
{showMesh?.map((item) => (
<React.Fragment key={item.skuId}>{CLOTHES_LIST[item.skuId]}</React.Fragment>
))}
</group>
)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels