Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
包含personal three.js库时出现意外行为_Three.js_Aframe - Fatal编程技术网

包含personal three.js库时出现意外行为

包含personal three.js库时出现意外行为,three.js,aframe,Three.js,Aframe,警告:以下是根据经验确定的 如果您正在用Aframe编写应用程序,请注意,您不需要在html中包含three.js库,因为Aframe附带了自己的three.js版本,并且应用程序的非Aframe部分也可以使用这个three.js版本。事实上,你不仅不需要它,而且绝对不应该包括它 如果您包含自己版本的three.js,那么框架将在构建时使用它。虽然大多数情况下这不会导致问题,但它可能会导致不可预测的结果。例如,我混合使用了Aframe-master.js v0.5,它假设为three.js v8

警告:以下是根据经验确定的

如果您正在用Aframe编写应用程序,请注意,您不需要在html中包含three.js库,因为Aframe附带了自己的three.js版本,并且应用程序的非Aframe部分也可以使用这个three.js版本。事实上,你不仅不需要它,而且绝对不应该包括它

如果您包含自己版本的three.js,那么框架将在构建时使用它。虽然大多数情况下这不会导致问题,但它可能会导致不可预测的结果。例如,我混合使用了Aframe-master.js v0.5,它假设为three.js v84,也假设three.js v85中存在src'ing,我收到了以下错误消息:

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)
Uncaught错误:`Entity.setObject3D`是用一个不是THREE.Object3D实例的对象调用的。
在HTMLElement.value处(aframe master.js:72729)
在aframe master.js:66470
在aframe master.js:48132
在ObjectLoader.parse(Three.js:32979)
三点。js:32938
在XMLHttpRequest。但是Frame master v0.5是针对three.js v84构建的,three.js v84仍然拥有它,并且假设它在那里


我运行混合版本有一段时间很好,所以这是一个微妙的错误。如果你确实遇到了这样的情况,你肯定会遇到其他的错误。我之所以记录这一点,是因为我花了半天的时间试图弄明白这一点,也许我可以省去其他人的麻烦。

如果使用框架,请不要在html中包含三个.js:

<!doctype html>
<html lang="en">
<head>
    <title>A-frame controller test</title>
    <meta charset="utf-8">
    <link rel="shortcut icon" href="">
    <meta name="viewport" content="width=device-width, user-scalable=no, minimum-scale=1.0, maximum-scale=1.0">
  <script src="lib/aframe-master.js"></script>
</head>
<body>
  <script src="https://code.jquery.com/jquery-3.1.1.js" integrity="sha256-16cdPddA6VdVInumRGo6IbivbERE8p7CQR3HzTBuELA=" crossorigin="anonymous"></script>
  <script src="lib/Three.js"></script> <!-- remove this -->
  <script src="lib/grab.js"></script> 
  <script src="js/main.js"></script>
    <a-scene>
好(three.js v.84无处不在):

A-Frame Version: 0.5.0 (Date 03-05-2017, Commit #31d05b0)
aframe-master.js:76936 three Version: ^0.84.0
aframe-master.js:76937 WebVR Polyfill Version: dmarcos/webvr-polyfill#a02a8089b
THREE.WebGLRenderer 85dev 
A-Frame Version: 0.5.0 (Date 03-05-2017, Commit #31d05b0)
aframe-master.js:76936three Version: ^0.84.0
aframe-master.js:76937WebVR Polyfill Version: dmarcos/webvr-polyfill#a02a8089b
aframe-master.js:24581 THREE.WebGLRenderer 84