我用小游戏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(delta);
//console.log("t", t)*
}
同问
问一下小游戏能加载gltf模型文件吗?
请问下,小游戏只能加载jsonLoader吗?能不能使用别的格式的模型?
是啊,getDelta()单位是s,这儿不知怎么搞得就变成ms了。
老哥,我一年前也在web端做过一小段时间的three.js开发,现如今想在微信小程序端尝试,却处处碰壁,觉得无从下手,请问老哥能对我指点一二吗?这是我的联系方式--QQ:1035897872
刚才找到问题,是时间过慢,导致根本看见不见动作,现在已经修复了,IDE上没问题,但是在真机上,真机报死循环的错误,不知道哪里有问题?