Aframe: How do I link entities, so the user can link/unlink entities, and so entities will animate together,...











up vote
0
down vote

favorite












How would I link and unlink multiple entities together so that they can be animated together.



An example is that there is a small pile of entities. When I click on this pile it spreads apart and floats upwards towards the user, so it's not a pile any more but a series of discreet entities each separated by a small distance.



The pile exists of 3 entities A, B, and C



If I click on the entity with id A then they all scale/position/rotate back into a pile.



If I click on entity id B then all entities move to the left. If I click on entity C then C leaves the pile and it's movements are no longer associated with the pile.



There is another pile with entities X, Y and Z



If entity X, Y, or Z is near entity C, then entity C joins the X, Y, Z pile. If the user clicks on entity Z and drags it over to be near entity A or B then entity Z joins pile A & B,



So then if entity A is clicked then A, B and Z will scale, rotate, and position together.










share|improve this question







New contributor




Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
























    up vote
    0
    down vote

    favorite












    How would I link and unlink multiple entities together so that they can be animated together.



    An example is that there is a small pile of entities. When I click on this pile it spreads apart and floats upwards towards the user, so it's not a pile any more but a series of discreet entities each separated by a small distance.



    The pile exists of 3 entities A, B, and C



    If I click on the entity with id A then they all scale/position/rotate back into a pile.



    If I click on entity id B then all entities move to the left. If I click on entity C then C leaves the pile and it's movements are no longer associated with the pile.



    There is another pile with entities X, Y and Z



    If entity X, Y, or Z is near entity C, then entity C joins the X, Y, Z pile. If the user clicks on entity Z and drags it over to be near entity A or B then entity Z joins pile A & B,



    So then if entity A is clicked then A, B and Z will scale, rotate, and position together.










    share|improve this question







    New contributor




    Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
    Check out our Code of Conduct.






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      How would I link and unlink multiple entities together so that they can be animated together.



      An example is that there is a small pile of entities. When I click on this pile it spreads apart and floats upwards towards the user, so it's not a pile any more but a series of discreet entities each separated by a small distance.



      The pile exists of 3 entities A, B, and C



      If I click on the entity with id A then they all scale/position/rotate back into a pile.



      If I click on entity id B then all entities move to the left. If I click on entity C then C leaves the pile and it's movements are no longer associated with the pile.



      There is another pile with entities X, Y and Z



      If entity X, Y, or Z is near entity C, then entity C joins the X, Y, Z pile. If the user clicks on entity Z and drags it over to be near entity A or B then entity Z joins pile A & B,



      So then if entity A is clicked then A, B and Z will scale, rotate, and position together.










      share|improve this question







      New contributor




      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      How would I link and unlink multiple entities together so that they can be animated together.



      An example is that there is a small pile of entities. When I click on this pile it spreads apart and floats upwards towards the user, so it's not a pile any more but a series of discreet entities each separated by a small distance.



      The pile exists of 3 entities A, B, and C



      If I click on the entity with id A then they all scale/position/rotate back into a pile.



      If I click on entity id B then all entities move to the left. If I click on entity C then C leaves the pile and it's movements are no longer associated with the pile.



      There is another pile with entities X, Y and Z



      If entity X, Y, or Z is near entity C, then entity C joins the X, Y, Z pile. If the user clicks on entity Z and drags it over to be near entity A or B then entity Z joins pile A & B,



      So then if entity A is clicked then A, B and Z will scale, rotate, and position together.







      entity aframe webvr webxr






      share|improve this question







      New contributor




      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.











      share|improve this question







      New contributor




      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      share|improve this question




      share|improve this question






      New contributor




      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.









      asked Nov 21 at 1:52









      Micah Blumberg

      11




      11




      New contributor




      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.





      New contributor





      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.






      Micah Blumberg is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
      Check out our Code of Conduct.
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          I believe the core question is how to re-parent entities to and from entity containers, assuming it is understood that animating/moving an entity container moves all its children, and how to listen to click events. Here's a container:



          <a-entity id="groupContainer" animation__position="..." animation__scale="..." animation__rotation="...">
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          </a-entity>


          There isn't a clean way to re-parent the A-Frame entities at the DOM level yet since detaching/re-attaching will remove/reinitialize all components. You can move the entity out with three.js.



          var someOtherContainer = document.getElementById('someOtherContainer').object3D;
          var childToReparent = document.querySelector('#someChildToRemoveFromContainer');
          someOtherContainer.add(childToReparent);





          share|improve this answer





















          • Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
            – Micah Blumberg
            Nov 21 at 9:00










          • So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
            – Micah Blumberg
            Nov 21 at 9:00










          • So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
            – Micah Blumberg
            Nov 21 at 9:06












          • Maybe animation-timeline component?
            – ngokevin
            Nov 21 at 10:15











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });






          Micah Blumberg is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404248%2faframe-how-do-i-link-entities-so-the-user-can-link-unlink-entities-and-so-ent%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          I believe the core question is how to re-parent entities to and from entity containers, assuming it is understood that animating/moving an entity container moves all its children, and how to listen to click events. Here's a container:



          <a-entity id="groupContainer" animation__position="..." animation__scale="..." animation__rotation="...">
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          </a-entity>


          There isn't a clean way to re-parent the A-Frame entities at the DOM level yet since detaching/re-attaching will remove/reinitialize all components. You can move the entity out with three.js.



          var someOtherContainer = document.getElementById('someOtherContainer').object3D;
          var childToReparent = document.querySelector('#someChildToRemoveFromContainer');
          someOtherContainer.add(childToReparent);





          share|improve this answer





















          • Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
            – Micah Blumberg
            Nov 21 at 9:00










          • So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
            – Micah Blumberg
            Nov 21 at 9:00










          • So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
            – Micah Blumberg
            Nov 21 at 9:06












          • Maybe animation-timeline component?
            – ngokevin
            Nov 21 at 10:15















          up vote
          0
          down vote













          I believe the core question is how to re-parent entities to and from entity containers, assuming it is understood that animating/moving an entity container moves all its children, and how to listen to click events. Here's a container:



          <a-entity id="groupContainer" animation__position="..." animation__scale="..." animation__rotation="...">
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          </a-entity>


          There isn't a clean way to re-parent the A-Frame entities at the DOM level yet since detaching/re-attaching will remove/reinitialize all components. You can move the entity out with three.js.



          var someOtherContainer = document.getElementById('someOtherContainer').object3D;
          var childToReparent = document.querySelector('#someChildToRemoveFromContainer');
          someOtherContainer.add(childToReparent);





          share|improve this answer





















          • Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
            – Micah Blumberg
            Nov 21 at 9:00










          • So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
            – Micah Blumberg
            Nov 21 at 9:00










          • So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
            – Micah Blumberg
            Nov 21 at 9:06












          • Maybe animation-timeline component?
            – ngokevin
            Nov 21 at 10:15













          up vote
          0
          down vote










          up vote
          0
          down vote









          I believe the core question is how to re-parent entities to and from entity containers, assuming it is understood that animating/moving an entity container moves all its children, and how to listen to click events. Here's a container:



          <a-entity id="groupContainer" animation__position="..." animation__scale="..." animation__rotation="...">
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          </a-entity>


          There isn't a clean way to re-parent the A-Frame entities at the DOM level yet since detaching/re-attaching will remove/reinitialize all components. You can move the entity out with three.js.



          var someOtherContainer = document.getElementById('someOtherContainer').object3D;
          var childToReparent = document.querySelector('#someChildToRemoveFromContainer');
          someOtherContainer.add(childToReparent);





          share|improve this answer












          I believe the core question is how to re-parent entities to and from entity containers, assuming it is understood that animating/moving an entity container moves all its children, and how to listen to click events. Here's a container:



          <a-entity id="groupContainer" animation__position="..." animation__scale="..." animation__rotation="...">
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          <a-entity class="child"></a-entity>
          </a-entity>


          There isn't a clean way to re-parent the A-Frame entities at the DOM level yet since detaching/re-attaching will remove/reinitialize all components. You can move the entity out with three.js.



          var someOtherContainer = document.getElementById('someOtherContainer').object3D;
          var childToReparent = document.querySelector('#someChildToRemoveFromContainer');
          someOtherContainer.add(childToReparent);






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 at 7:28









          ngokevin

          8,66611454




          8,66611454












          • Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
            – Micah Blumberg
            Nov 21 at 9:00










          • So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
            – Micah Blumberg
            Nov 21 at 9:00










          • So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
            – Micah Blumberg
            Nov 21 at 9:06












          • Maybe animation-timeline component?
            – ngokevin
            Nov 21 at 10:15


















          • Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
            – Micah Blumberg
            Nov 21 at 9:00










          • So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
            – Micah Blumberg
            Nov 21 at 9:00










          • So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
            – Micah Blumberg
            Nov 21 at 9:06












          • Maybe animation-timeline component?
            – ngokevin
            Nov 21 at 10:15
















          Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
          – Micah Blumberg
          Nov 21 at 9:00




          Well besides the reparenting question, it’s also about how to define individual or independent simultaneous &or subsequent scaling/rotation/positioning for each entity in the container So a-entity id=group animation begin=click><a-entity id=A class=child scale=“from V V V; to R R R”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”><a-entity id=B class=child scale=“from C C C; to D D D”, position=from G G G; to P P P, rotation=“from S S S to A A A”><a-entity id=C class=child scale=“from M M M; to O O O”, position=from T T T; to N N N, rotation=“from U U U to Q Q Q”></animation>
          – Micah Blumberg
          Nov 21 at 9:00












          So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
          – Micah Blumberg
          Nov 21 at 9:00




          So my object was to illustrate that 1 click, could cause simultaneous scale/position/rotation for each entity in the group, and each entity would have it’s own scale/position/rotation, independently defined, and each entity could have a path or series of scale/positions and rotations.
          – Micah Blumberg
          Nov 21 at 9:00












          So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
          – Micah Blumberg
          Nov 21 at 9:06






          So animate a-entity id=group2 a-entity id=child1ofgroup2 Scale from XYZ to new XYZ Scale from XYZ to new XYZ Duration Position from XYZ to new XYZ Scale from XYZ to new XYZ Ease, Duration Rotate from XYZ to new XYZ Scale from XYZ to new XYZ Position from XYZ to new XYZ a-entity id=child2ofgroup2 Scale Position Duration/Ease Position Duration2/ease2 Scale2 Rotate/Position/Scale duration Scale
          – Micah Blumberg
          Nov 21 at 9:06














          Maybe animation-timeline component?
          – ngokevin
          Nov 21 at 10:15




          Maybe animation-timeline component?
          – ngokevin
          Nov 21 at 10:15










          Micah Blumberg is a new contributor. Be nice, and check out our Code of Conduct.










           

          draft saved


          draft discarded


















          Micah Blumberg is a new contributor. Be nice, and check out our Code of Conduct.













          Micah Blumberg is a new contributor. Be nice, and check out our Code of Conduct.












          Micah Blumberg is a new contributor. Be nice, and check out our Code of Conduct.















           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53404248%2faframe-how-do-i-link-entities-so-the-user-can-link-unlink-entities-and-so-ent%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          Sphinx de Gizeh

          Dijon

          Langue