javascript - 我无法在 A-frame 中加载 .glb 文件!我该如何解决?
问题描述
我是 a-frame 的新手,我尝试在 A-frame 中加载 .glb 文件,但在场景中看不到它!我该如何解决?我在下面有代码,还注意到它与 .obj 文件完美配合。
{% load static %}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
{% block threedtitle %}{% endblock %}
<style>
body {
margin: 0;
}
canvas {
width: 100%;
height: 100%;
}
</style>
<script src="https://aframe.io/releases/1.0.4/aframe.min.js"></script>
<script src="https://unpkg.com/aframe-event-set-component@^4.0.0/dist/aframe-event-set-component.min.js"></script>
<script src="https://unpkg.com/aframe-environment-component/dist/aframe-environment-component.min.js"></script>
</head>
<body>
<a-scene background="color: #EAEAEA">
<a-asset>
<a-asset-item id="toilet-glb" src="{% static '3d_file/toilet.glb' %}"></a-asset-item>
</a-asset>
<!-- Camera -->
<a-entity position="0 100 100">
<a-camera></a-camera>
</a-entity>
<!-- toilet -->
<a-entity gltf-model="#toilet-glb" position="0 0 10" scale="0.08 0.08 0.08"
animation="property: rotation; to: 0 360 0; dur: 14000; easing: linear; loop: true">
</a-entity>
</a-scene>
</body>
</html>
解决方案
Not sure what seems wrong but try this:
<a-entity gltf-model="src: url({% static '3d_file/toilet.glb' %})" ...></a-entity>
also check:
- Are you sure about the
position
not at0 0 0
? - The
scale
is so small! - Is
{% static '3d_file/toilet.glb' %}
return correct URL? - Maybe the
animation=
part cause some error?
推荐阅读
- python - 使用两个“空格”分隔符解析文本文件
- java - IntelliJ 的 Springboot 配置中的“更正应用程序的类路径”
- python - DEAP 健身和健身值之间的区别
- ruby-on-rails - 更新父级时更新Rails中关联模型中的属性
- sql - Postgresql:如果LEFT JOIN中的数据存在,则替换选择中的参数
- python - 为什么 Anaconda 为带有和不带 GPU 的 Tensorflow 提供单独的包,我应该使用 conda 还是 pip?
- c - C语言中的简单金字塔
- python - 通过 tor socks 代理发送数据请求时出现 403
- r - 如何根据第三列的共享 ID 从一个数据框中获取数据并将其复制到另一个数据框中的现有列中
- c++ - std::C++ 在非空队列中异步读写会导致竞争条件吗?