【问题标题】:Aframe Google Poly API not rendering in Aframe how can I fix this?Aframe Google Poly API 未在 Aframe 中呈现,我该如何解决?
【发布时间】:2020-07-02 08:22:13
【问题描述】:

我尝试了 aframe GBlock 组件,我从 Google Poly 检索了我自己的 api 代码 https://github.com/archilogic-com/aframe-gblock 无法显示随机样本模型(出现在我的场景中) 所以我再次尝试使用 aframe google poly 组件https://github.com/mattrei/aframe-google-poly-component 这次是我自己的 Google Poly 艺术作品和我自己的 api

似乎都没有工作,下面的示例代码应该适用于它的两个版本

<!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/aframe-google-poly-component@1.0.0/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>

【问题讨论】:

    标签: aframe


    【解决方案1】:

    只需使用 AFRAME,无需其他库。获取资产的 URL 并将其放入这样的实体中(等待卡车装载):

    <!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>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-06-09
      • 2020-05-08
      • 2023-04-02
      • 2021-12-31
      • 2019-03-24
      • 2021-07-12
      • 2021-11-22
      相关资源
      最近更新 更多