【发布时间】:2022-01-23 06:15:06
【问题描述】:
单击<a-entity> 时,我正在尝试加载 HTML 文件,但它不适用于传统的 HTML 方法。(使用 href)
请看下面的代码。
<a-scene>
<a-assets>
<a-asset-item id="mBot" src="../assets/robot1.glb"></a-asset-item>
<img id="panorama" src="../assets/stock.jpg" />
</a-assets>
<!-- Robot -->
<a-entity
gltf-model="#mBot"
scale="4 4 4"
position="0 1 2"
id="mBot-1"
>
<a-animation attribute="rotation" to="0 360 0" repeat="indefinite" >
</a-animation>
</a-entity>
<!-- Robot -->
<a-entity
gltf-model="#mBot"
scale="4 4 4"
position="8 1 2"
id="mBot-2"
>
<a-animation attribute="rotation" to="0 -360 0 " repeat="indefinite">
</a-animation>
</a-entity>
<a-entity position="4 0 8">
<a-camera></a-camera>
</a-entity>
<a-sky src="#panorama"></a-sky>
</a-scene>
单击实体 id=mBot-1 和 mBot-2 时,我想加载两个单独的 html 文件。
非常感谢任何帮助解决这个问题。
【问题讨论】:
-
1) 查看this thread,有一个带有链接的示例。 2)在大多数情况下加载“本地”html文件你需要一个本地服务器,或者使用文件协议:
file:///path_to_file.html(thread) -
使用了第一个线程中提到的 JS,感谢您的提示!
标签: javascript html jquery augmented-reality aframe