variables - Trying to use a customisable template to display a 5 sided box multiple times - Stack Overflow

I am using aframe-template-compoment with variables but just seem to get consol errors telling me the p

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.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744084142a4555852.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信