ToughNutToCrack / ARWT

This library allows you to use Unity to build AR Web applications, working as a bridge between Unity and the best AR libraries available for the Web.
MIT License
304 stars 79 forks source link

Model does not show up in WebGl (localhost) when the marker is changed #4

Open NGUYENTRUONGKHANH opened 3 years ago

NGUYENTRUONGKHANH commented 3 years ago

I used the example scene (ARMarker Rotate and Scale) in Project ARWT. I added the model and an outer image after creating it with AR.js Marker Training (https://jeromeetienne.github.io/AR.js/three.js/examples/marker-training/examples/generator.html ). Follow the instructions on your site. But when built WebGL app (test in LocalHost), the AR model is not displayed, the camera screen blinks continuously. Looking forward to the support. Thank you very much!

sgoisbeault commented 3 years ago

I got the same issue and fixed it by using the latest versions of ar.js. In the index.html file of the WebAR template (Assets/WebGLTemplates/WebAR), replace the .js scripts references from local js/lib folder to the web urls. Here's my new index.html :

<!DOCTYPE html>
<html lang="en-us">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>Unity WebGL Player | WebGL Test AR</title>
    <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
    <script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
    <script src="Build/UnityLoader.js"></script>
    <script src="js/app.js"></script>

  </head>

  <body style="margin: 0px; overflow: hidden;">
    <a-scene embedded arjs vr-mode-ui="enabled: false" copycanvas>
      <div id="unityContainer" style="z-index: 2" ></div>
      <!-- <a-marker preset="hiro"> <a-box></a-box> </a-marker> -->
      <!-- <a-marker type="pattern" url="data/markers/pattern-arjs.patt"><a-box></a-box></a-marker> -->
      <!-- <a-marker type="pattern" url="data/markers/test.patt" markercontroller="name : hiro"></a-marker> -->

      --MARKERS--
      <a-entity camera cameratransform></a-entity>
    </a-scene>
  </body>
</html>
thirdrow commented 3 years ago

I added that to my template, still not showing a model...I have to be missing something? Using Mac OS 11.5.2, Unity 2021.1.22f1, on the phone side I am using an iPhone Xs Max running 14.6 and Safari to view the page. In player settings, I am using the supplied template from the ARWT-Master Project. Uploaded to my webserver with all the files, changes to the template are showing when I look at the source...just not image recognition and no model showing up.