我尝试了aframe GBlock组件,我从Google Poly中检索了自己的api代码https://github.com/archilogic-com/aframe-gblock无法显示随机样本模型(出现在我的场景中)所以我再次尝试使用无框Google多边形组件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/[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>
只需使用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>