LoginSignup
2
1

More than 3 years have passed since last update.

AR.jsでobjにノイズが乗る件

Last updated at Posted at 2019-10-03

課題

AR.jsで、objファイルを動かした際、ぐちゃぐちゃとノイズが乗ってしまうバグを修正する方法。

aframe 0.8.0
ar.js 1.7.7

結論

htmlファイルで読み込んでいるjsファイルに、以下の文を追加すればOKです。

index.js
function init() {
    const sceneEl = document.querySelector('a-scene');
    sceneEl.addEventListener('loaded', () => {
        sceneEl.camera = new THREE.PerspectiveCamera();
    });
}

よく分からない人は、htmlファイルに以下を入れてあげてください。

index.html
<!-- 省略 -->
      <script>
        const sceneEl = document.querySelector('a-scene');
        sceneEl.addEventListener('loaded', () => {
            sceneEl.camera = new THREE.PerspectiveCamera();
        });
      </script>
   </body>
</html>

ソースはこちらです。
https://github.com/jeromeetienne/AR.js/issues/410

どうやらAR.jsのバグらしいです。
やっていること自体は、a-sceneタグのカメラプロパティーにThree.jsのカメラを設定してあげているだけ。

2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1