Micah Blumberg
Micah Blumberg

Reputation: 79

Aframe Google Poly API not rendering in Aframe how can I fix this?

I tried the aframe GBlock component, I retrieved my own api code from Google Poly https://github.com/archilogic-com/aframe-gblock could not get a random sample model to display (show up in my scene) so I tried it again with the aframe google poly component https://github.com/mattrei/aframe-google-poly-component this time with my own Google Poly art and with my own api

neither one seems to be working, the sample code below should be working for both versions of it

<!DOCTYPE html>
<html>
  <head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>
  <script src="https://unpkg.com/[email protected]/dist/aframe-google-poly-component.min.js"></script>
  <script src="https://cdn.rawgit.com/archilogic-com/aframe-gblock/6498b71d/dist/gblock.js"></script>
</head>

<body>
  <a-scene>
    
   <a-entity google-poly="apiKey: where api key goes; src: 0uYBSdP3NhE" 
             position="0 0 -3" scale="1 1 1"
        ></a-entity>
    
    <a-entity gblock="https://poly.google.com/view/0uYBSdP3NhE?key=AIzaSyA4vpWo4AoLlbA2ecEIpA0T8CbDrlm_Nmw" 
              scale="1 1 1" position="25.806 14.071 -6.306" rotation="0 -38.73194695084365 0"></a-entity>

    <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
      
  </a-scene>
</body>
</html>

Upvotes: 2

Views: 159

Answers (1)

JMA
JMA

Reputation: 1825

Just use AFRAME, no need for other libraries. Get the asset's URL and put it in an entity like this (wait for the truck to load):

<!DOCTYPE html>
<html>

<head>
  <title>My A-Frame Scene</title>
  <script src="https://aframe.io/releases/0.9.2/aframe.min.js"></script>

</head>

<body>
  <a-scene>
    <a-entity gltf-model="https://poly.googleapis.com/downloads/fp/1575545288491751/2u4e9d0aePt/fSG2yghO86V/model.gltf" scale="1 1 1" position="0 0 0" rotation="0 -38.73194695084365 0"></a-entity>
    <a-plane position="0 0 -4" rotation="-90 0 0" width="4" height="4" color="#7BC8A4"></a-plane>
  </a-scene>
</body>

</html>

Upvotes: 1

Related Questions