繁体   English   中英

使用three.js r68进行js模型动画

[英]js Model Animation Using three.js r68

如标题所述,我无法使动画正常工作。 我可以肯定我的代码中缺少某些东西,因为它在这里工作 ,但在我测试的地方没有。

我在playerCharacter.js中创建动画对象

this.init = function(){
    for (var k in this.mesh.material.materials) {this.mesh.material.materials[k].skinning = true;}

    this.animation = new THREE.Animation(this.mesh, this.mesh.geometry.animations[0].name);
    this.animation.play();
}

在更新功能中,我使用:

    this.animation.update(0.017);

当我查看控制台日志时,我得到:

Uncaught TypeError: Cannot read property 'length' of undefined 

因此,似乎在THREE.AnimationHandler中,data.hierarchy是未定义的,因此我猜测如果可以通过某种方式对其进行定义,则此问题将得到解决。 除非我不知道如何,甚至不知道为什么。 有什么帮助吗?

您仅传递动画的名称,而不传递整个data对象。 使用此代替:

this.animation = new THREE.Animation(this.mesh, this.mesh.geometry.animations[0]);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM