admin 管理员组文章数量: 1086019
I am using aframe-template-compoment with variables but just seem to get consol errors telling me the position is NaN. I am using the aframe-template-component but not sure if I am using it right with variables or mathematics included.
<html>
<head>
<script src=".7.0/aframe.min.js"></script>
<script src="/[email protected]/dist/aframe-template-component.min.js"></script>
</head>
<body>
<a-scene>
<!-- Define Template -->
<script id="draw" type="text/html">
<a-box class="draw__front"
position="0 0 {((dd || 1) / 2) - ((dt || 0.05) / 2)}"
width="{dw || 1}"
height="{dh || 1}"
depth="{dt || 0.05}"
color="#FF0000"></a-box>
<a-box class="draw__back"
position="0 0 {-(dd || 1) / 2 + (dt || 0.05) / 2}"
width="{dw || 1}"
height="{dh || 1}"
depth="{dt || 0.05}"
color="#00FF00"></a-box>
<a-box class="draw__bottom"
position="0 {-(dh || 1) / 2 + (dt || 0.05) / 2} 0"
width="{(dw || 1) - 2 * (dt || 0.05)}"
height="{dt || 0.05}"
depth="{(dd || 1) - 2 * (dt || 0.05)}"
color="#0000FF"></a-box>
<a-box class="draw__left"
position="{-(dw || 1) / 2 + (dt || 0.05) / 2} 0 0"
width="{dt || 0.05}"
height="{dh || 1}"
depth="{dd || 1}"
color="#FFFF00"></a-box>
<a-box class="draw__right"
position="{(dw || 1) / 2 - (dt || 0.05) / 2} 0 0"
width="{dt || 0.05}"
height="{dh || 1}"
depth="{dd || 1}"
color="#00FFFF"></a-box>
</script>
<!-- Camera Entity -->
<a-entity camera look-controls wasd-controls position="0 0 0"></a-entity>
<!-- Template instances with dynamic attributes -->
<a-entity template="src: #draw"
position="5 0 0"
dw="1"
dh="1"
dd="1"
dt=".05"></a-entity>
</a-scene>
</body>
</html>
Any help appreicated, just learning.
本文标签: variablesTrying to use a customisable template to display a 5 sided box multiple timesStack Overflow
版权声明:本文标题:variables - Trying to use a customisable template to display a 5 sided box multiple times - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://roclinux.cn/p/1744084143a2530804.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论