Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/haskell/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Aframe A帧模板组件+nunjucks模板显示在代码中,但不显示在场景中_Aframe_Nunjucks - Fatal编程技术网

Aframe A帧模板组件+nunjucks模板显示在代码中,但不显示在场景中

Aframe A帧模板组件+nunjucks模板显示在代码中,但不显示在场景中,aframe,nunjucks,Aframe,Nunjucks,我对Nunjuck知之甚少,因此如果我完全走错了方向,我深表歉意,但这是我尝试将它与框架模板组件结合使用,以在不同位置生成10个建筑实体 我在我的index.html中创建了此脚本标记: <script id="building" type="text/x-nunjucks-template"> {% for x in range(0, 10) %} <a-entity template="src: building.template; type: handleba

我对Nunjuck知之甚少,因此如果我完全走错了方向,我深表歉意,但这是我尝试将它与框架模板组件结合使用,以在不同位置生成10个建筑实体

我在我的index.html中创建了此脚本标记:

<script id="building" type="text/x-nunjucks-template">
  {% for x in range(0, 10) %}
    <a-entity template="src: building.template; type: handlebars"
              data-position="{{ x * 10 }} 1 0" 
              data-positionB="{{ x * 10 }} 1 0" 
              from="#frontInner{{ x }}" 
              to="#frontOuter{{ x }}">
    </a-entity>
  {% endfor %}
</script> 
我将此实体放置在场景中:

<a-entity template="src: #building"></a-entity>
我创建了一个building.template文件,其中包含要创建多个版本的建筑的简化版本:

                    <rw-room data-position material="color:#866" width="4.8" length="4.8" height="3">
                        <rw-wall >              
                            </rw-wall>
                            <rw-wall >
                            </rw-wall>
                            <rw-wall >
                                <rw-doorhole id="frontInner{{ x }}" material="color:#866"></rw-doorhole>
                            </rw-wall>   
                            <rw-wall >

                            </rw-wall>
                            <rw-floor material="color:#870"></rw-floor>
                            <rw-ceiling material="color:#880"></rw-ceiling>
                        </rw-room>
                        <rw-room data-positionB material="color:#866" width="5" length="5" height="3" outside="true">
                            <rw-wall ></rw-wall>
                            <rw-wall ></rw-wall>
                            <rw-wall ></rw-wall>
                            <rw-wall >
                                <rw-doorhole id="frontOuter{{ x }}" material="color:#866"></rw-doorhole>
                                <rw-doorlink from to position="2.5 0 0" material="color:#866" >
                                    <rw-floor material="color:#866"></rw-floor>
                                    <rw-ceiling material="color:#866"></rw-ceiling>
                                    <rw-sides material="color:#866"></rw-sides>
                                </rw-doorlink>
                            </rw-wall>
                            <rw-floor material="color:#866"></rw-floor>
                            <rw-ceiling material="color:#866"></rw-ceiling>
                        </rw-room>
然而,这些建筑在场景中并没有出现在视觉上。任何关于如何解决这个问题的建议都将不胜感激

rw房间、rw墙。。。不是A帧实体,它们将不会被渲染。在模板中使用a-entity和而不是wr XXX元素。e、 g:


感谢您的回复,我忘了提到rw XXX元素来自我导入并一直使用的aframe room组件。我发现rw元素在使用时完全可以正常工作,而不需要直接将模板放在index.html中,但不能与NUNJUCK一起使用。你是说如果我正在模板化,我就不能使用框架房间组件吗?非常感谢。如果相同的标记在没有模板的情况下工作,那么很可能就是问题所在。我不知道Nunjuck或框架房间组件是如何工作的。确保在A-Frame之后和Nunjuk之前加载框架房间组件是的,我在building.template中添加了其他元素,如A-box/A-cylinder,它们出现了,所以将框架房间组件与Nunjuk一起使用时一定有错误。谢谢你帮我澄清!