-
I'm trying to get an AnimationAction from an AnimationClip. For some reason, the importer leaves the action empty, but I have the clips object and it does contain a reference. But, if I try to create an animation with I can clearly see that the clip is there and has a UUID and clipAction isn't called until after clips[0] is available. Maybe my brain isn't working today, but I don't see what I'm doing wrong here. The fun starts on line 31. https://codesandbox.io/s/why-clippy-no-play-ksnvn9?file=/src/index.js |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
im not sure if this is correct. useAnimation is an abstraction to cast clips into actions, it needs a root (2nd arg) or else the clips aren't valid, see: https://github.com/pmndrs/drei#useanimations const { scene, animations } = useGLTF("/psyko.glb")
const { actions } = useAnimations(animations, scene)
useEffect(() => {
//if (clips[0]) {
//console.log(actions)
actions["Armature|Armature|Psyko_Armature|Armature|Psyko_Armature"].play()
//actions["dance"] = mixer.clipAction(clips[0])
//actions["dance"].play()
//}
}, [actions]) the file only contains one clip named "Armature|Armature|Psyko_Armature|Armature|Psyko_Armature" and it plays. it looks to me you want to make your own actions, at least i'm guessing that's why you call clipAction (?) which isn't needed with useAnimations. in that case i'd much rather create a plain THREE.Mixer and go without abstractions, everything's under your control. |
Beta Was this translation helpful? Give feedback.
im not sure if this is correct. useAnimation is an abstraction to cast clips into actions, it needs a root (2nd arg) or else the clips aren't valid, see: https://github.com/pmndrs/drei#useanimations
the file only contains one clip named "Armature|Armature|Psyko_Armature|Armature|Psyko_Armature" and it plays. it looks to me …