Hello,
I’m trying to execute the animation of a model found on internet.
The expected animation is to have all the fans running. But when I tried to play the animation, it’s just the computer rotating on the X abscissa. I thought maybe its animations are somewhere else, so I logged the animation, and there is an array of tracks with all the fans in it. Being new in threejs I was wondering if anyone could help me on that.
const { actions } = useAnimations(animations, group)
useEffect(() => {
actions['Task 001'].play()
})
This is the model I use.
Computer model
Running the model (auto-converted .gltf
) on gltf-viewer seems to work just fine. 
Are you sure you don’t apply the rotation yourself? Could you share a codepen / demo replicating the issue?
Yes I know, this is why I found that weird.
Yes I’m sure, I just loaded the model and use the play method without touching anything else.
I don’t think it’s possile to load 3D model in codepen. But here is what I’ve done
export const Introduction = () => {
return (
<>
<Canvas className="bg-[#141B32]" style={{height: "100vh"}}>
<OrbitControls />
<directionalLight intensity={0.5} />
<ambientLight intensity={2} />
<Suspense fallback={null} >
<Model />
</Suspense>
</Canvas>
<Loader />
</>
)
}
and in the model, which is 4000 lines, I just made
const group = useRef()
const { nodes, materials, animations } = useGLTF('/scene.gltf')
const { actions, names } = useAnimations(animations, group)
useEffect(() => {
console.log(actions[names].play())
})