superframe icon indicating copy to clipboard operation
superframe copied to clipboard

[template] Position of template object resets to 0

Open UXVirtual opened this issue 6 years ago • 7 comments

I'm having some issues when applying the following template:

<script id="boxesTemplate" type="text/html">
            <a-box width="0.2" height="1" depth="0.2" position="0 0.5 -0.2"></a-box>
            <a-box width="0.2" height="1" depth="0.2" position="-0.2 0.5 0.2"></a-box>
            <a-box width="0.2" height="1" depth="0.2" position="0.2 0.5 0"></a-box>
            <a-box width="1" height="0.2" depth="1"></a-box>
</script>

When applied to an entity the child <a-box> entities come through, but their position resets to 0:

<a-entity template="src: #boxesTemplate;"></a-entity>

I'm using aframe-template-component v3.2.1 from npm

UXVirtual avatar Oct 15 '17 02:10 UXVirtual

Seems like moving the above template into my HTML so it isn't included during the compile step fixes this issue. I'm using this component with ember.js and ember-aframe: https://github.com/ember-vr/ember-aframe

UXVirtual avatar Oct 17 '17 04:10 UXVirtual

@ngokevin same problem here using react and react-dom any idea?

arpu avatar Dec 13 '17 21:12 arpu

ok a "normal" project works fine glitch.com/edit/#!/kind-scourge

arpu avatar Dec 14 '17 03:12 arpu

this sample example with react does not work

/* global  AFRAME */
import AFRAME from 'aframe'
import 'aframe-template-component'


import React, { Component } from 'react';
import logo from './logo.svg';
import './App.css';

class App extends Component {
  render() {
    return (

      <a-scene>
      <a-assets>
       <script id="clouds" type="text/html">
        <a-text class="nametag" value="CLOUDS!" side="double" position="0 2 0" rotation="0 0 0" color="black"></a-text>
        </script>
      </a-assets>

 <a-entity id="sphere" geometry="primitive: sphere"
                material="color: #EFEFEF; shader: flat"
                position="0 0.15 -5"
                light="type: point; intensity: 5">
                </a-entity>

      <a-entity id="light" light="type: ambient; color: #888"></a-entity>
       <a-entity template="src: #clouds"></a-entity>
    </a-scene>
    );
  }
}

export default App;

arpu avatar Dec 14 '17 03:12 arpu

@ngokevin here is a test react project yarn install yarn start

templatebug.zip

arpu avatar Dec 14 '17 03:12 arpu

I'll try to look some time. Feel free to debug the component, it's not too complicated.

ngokevin avatar Dec 16 '17 04:12 ngokevin

any news on this?

arpu avatar Jan 21 '18 20:01 arpu