我用小游戏IDE引入three.js的json动画模型时,模型可以出来,动画怎么都出不来,请问有谁遇到过相同的问题吗?
var loader = new THREE.JSONLoader();
loader.load(‘http://image.nardiaoyu.com/video/2018/2/11/neex7hh.js’, function (geometry) {
var material = new THREE.MeshPhongMaterial({
color: 0xffffff,
specular: 0xffffff,
shininess: 20,
morphTargets: true,
vertexColors: THREE.FaceColors,
flatShading: true
});
var mesh = new THREE.Mesh(geometry, material);
var s = 0.35;
mesh.scale.set(s, s, s);
mesh.position.y = 15;
mesh.rotation.y = -1;
mesh.castShadow = true;
mesh.receiveShadow = true;
scene.add(mesh);
console.log(“mesh”, mesh)
mixer = new THREE.AnimationMixer(mesh);
mixer.clipAction(geometry.animations[0]).setDuration(1).play();
console.log(“mixer”, mixer)
mixers.push(mixer);
console.log(“mixers”, mixers)
for (var i = 0; i < mixers.length; i++) {
console.log(“mixers.length”, i)
}
});
animate() {
requestAnimationFrame(this.animate.bind(this), canvas);
this.render()
//console.log(“aaaaa”)
}
render() {
var delta = clock.getDelta();
for (var i = 0; i < mixers.length; i++) {
//console.log(“mixers.length”, mixers.length)
mixers[i].update(delta);
//console.log(“t”, t)*
}