簡體   English   中英

如何將 3d object 添加到我的網站?

[英]how do i add a 3d object into my website?

我有一個嵌入了 3D 對象的谷歌站點網站,如何將 OBJ 文件嵌入到網站上? 代碼如下:

<!DOCTYPE html>
<html>
    <head>
        <script src="https://aframe.io/releases/1.1.0/aframe.min.js"></script>
    </head>
    <body>
        <a-scene>


            <a-sphere position="0 -5 -24" radius="5" color="purple"></a-sphere>
            
            <a-sphere position="0 -5 -10" radius="4" color="green"></a-sphere>
            <a-sphere position="0 -5 -0" radius="3" color="red"></a-sphere>
            <a-sphere position="0 -5 10" radius="2" color="yellow"></a-sphere>
            <a-sphere position="0 -5 20" radius="1" color="blue"></a-sphere>
            
        </a-scene>
    </body>
</html>

這是要查看的站點: https://sites.google.com/view/aircraftrecognitionuk/home ,我想要一架飛機而不是球體,請有人可以為我編輯此代碼,TIA

文件名是:

平面.obj

或者,如果有人想在網站上幫助編輯它,請給我發消息,我可以添加你來幫助在谷歌網站上

您可以使用obj-model組件添加.obj model:

<a-scene>
  <!-- Preload with a-assets -->
  <a-assets>
    <a-asset-item id="model-obj" src="/path/to/model.obj"></a-asset-item>
    <a-asset-item id="model-mtl" src="/path/to/model.mtl"></a-asset-item>
  </a-assets>

  <!-- add the model to the scene -->
  <a-entity obj-model="obj: #model-obj; mtl: #model-mtl"></a-entity>
</a-scene>

最好您應該使用 gltf 模型,並使用gltf-model組件將它們添加到場景中。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM