for (let i = 0; i < 3; i++) {
that.loader.load('https://threejs.org/examples/models/fbx/Samba%20Dancing.fbx', (object) => {
object.position.set(-100 + i * 150, 0, 0)
object.children[0].position.set(0, 100, 0)
object.traverse((child) => {
if (child.isMesh) {
child.castShadow = true
child.receiveShadow = true
}
})
that.mixer = new THREE.AnimationMixer(object)
that.actions = that.mixer.clipAction(object.animations[0])
that.actions.play()
that.scene.add(object)
that.animate()
}
})
}
let 换成var 试试
代码逻辑问题,自己再理一遍代码,在这里很少有人通过你这一小段代码直接指出问题所在