2017-05-04 3 views
-1

注意:以下は経験的に決定されたものです。個人の3つの.jsライブラリを含めると予期しない動作が発生する

Aframeでアプリケーションを作成している場合は、AFrameには独自のバージョンのthree.jsが付属しているため、HTMLにthree.js libを含める必要はありません。アプリもこのバージョンのthree.jsを使用できます。実際には、あなたはそれを必要としないだけでなく、間違いなくでなければなりません。が含まれています。

独自のバージョンのthree.jsを含めると、AFrameはそれを使って作成したバージョンを使用します。ほとんどの場合、問題は発生しませんが、予期しない結果につながる可能性があります。例えば、私はV84 three.jsを前提とし、またthree.js V85にsrc'ing、私は次のエラーメッセージを受信AFRAME-master.js V0.5を、混合した

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) 

多くの研究の後、私はこれが3つの.js v85でdropped the blendCharacter objectであるが、まだフレームマスターv0.5がthree.js v84に対して作られていて、まだそれを持っていると仮定していると判断した。

私はしばらくの間、混合バージョンを正常に実行していたので、微妙なエラーです。状況が発生した場合、間違いなく他のエラーが発生します。私は半日を費やしてこれを把握しようとしていたので、これを文書化しています。

答えて

1

AFRAMEを使用している場合は、あなたのhtmlでthree.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> 

ルックをし、AFRAMEとthree.WebGlRendererは、同じバージョンを使用していることを確認してください。

バッド(混合を0.84および0.85)three.js:

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 

グッド(どこでもthree.js v.84):

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 
関連する問題