我在 React 应用程序中加载从 Sketchfab 下载的 GLTF 模型。模型加载得很好,但动画根本不播放。我尝试了不同的方法。有任何想法吗?
function Model({ url }) {
const model = useRef()
const { scene, animations } = useLoader(GLTFLoader, url)
const [mixer] = useState(() => new THREE.AnimationMixer())
useEffect(() => void mixer.clipAction(animations[0], group.current).play(), [])
return(
<primitive
ref={model}
object={scene}
/>
)
}