THREE.js - 导入的 JSON 网格上的 morphTargetInfluences 未获得结果

THREE.js - morphTargetInfluences on an imported JSON mesh not getting results

我有一个基本的 three.js 场景,我在其中尝试从 Blender 导出对象(作为 JSON 具有嵌入式变形的文件)以使用用户输入来运行和更新它们的形状。

这里是测试场景 http://onthez.com/temphosting/three-js-morph-test/morph-test.html

通过简单地缩放一个盒子来调整 slab 的大小而没有变形,这工作得很好。

我一定是错过了一些基本的东西,上面有小纪念碑。它有 3 个变形(宽度、深度、高度),旨在允许它调整大小。

我正在使用此代码实现基于用户 dat.gui 输入的变形。

folder1.add( params, 'width', 12, 100 ).step(1).name("Width").onChange( function () {
  updateFoundation();
  building.morphTargetInfluences['width'] = params.width/100;
  roofL.morphTargetInfluences['width'] = params.width/100;
  roofR.morphTargetInfluences['width'] = params.width/100;
  building.updateMorphs();
});

building、roofL 和 roofR 的材质都将 morphTargets 设置为 true。 我在这里查看了 three.js 示例: http://threejs.org/examples/?q=morph#webgl_morphtargets_human 以及#webgl_morphtargets 和#webgl_morphtargets_horse

如有任何想法或意见,我们将不胜感激!

我相信我已经为我的问题找到了解决方案我的印象是 JSON 加载器保留了 morphTargetInfluences[=10= 的变体目标名称以代替索引号]

类似于 morphTargetInfluences['myMorphTargetName'] 但是,在控制台中仔细检查后,似乎应该通过诸如 morphTargetInfluences[0]

之类的数字来引用它们

不是最直观的,但我可以使用它。