小游戏引入three.js的json模型真机测试出现死循环提示
发布于 5 年前 作者 napan 2269 次浏览 来自 问答

我用小游戏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")

//stats.update();

}


render() {

var delta = clock.getDelta();

for (var i = 0; i < mixers.length; i++) {

//console.log("mixers.length", mixers.length)


mixers[i].update(1000*delta);

//console.log("t", t)*

}

回到顶部