【发布时间】:2017-05-06 19:39:11
【问题描述】:
警告:以下是凭经验确定的。
如果您在 Aframe 中编写应用程序,请注意您不需要在 html 中包含 three.js 库,因为 AFrame 附带了它自己的three.js 版本以及您应用程序的非 Aframe 部分也可以使用这个版本的three.js。事实上,你不仅不需要它,你绝对应该不包含它。
如果您包含自己的 three.js 版本,那么 AFrame 将使用它而不是构建它的版本。虽然大多数情况下这不会导致问题,但它可能会导致不可预知的结果。例如,我正在混合 Aframe-master.js v0.5,它假设 three.js v84 和 src'ing 在three.js v85 中,我收到以下错误消息:
Uncaught Error: `Entity.setObject3D` was called with an object that was not an instance of THREE.Object3D.
at HTMLElement.value (aframe-master.js:72729)
at aframe-master.js:66470
at aframe-master.js:48132
at ObjectLoader.parse (Three.js:32979)
at Three.js:32938
at XMLHttpRequest.<anonymous> (Three.js:29098)
经过大量研究,我确定这是因为在three.js v85 中他们dropped the blendCharacter object 但aframe-master v0.5 是针对仍然有它并假设它存在的three.js v84 构建的。
我运行混合版本有一段时间了,所以这是一个微妙的错误。如果您确实遇到了情况,您肯定会遇到其他错误。我只是在记录这一点,因为我花了半天时间试图弄清楚这一点,也许我可以免去其他人的麻烦。
【问题讨论】: