supermedium / aframe-react

:atom: Build virtual reality experiences with A-Frame and React.
https://ngokevin.github.io/aframe-react-boilerplate/
MIT License
1.42k stars 151 forks source link

Dynamically adding Entities sometimes results in invisible Entities #46

Closed cakenggt closed 7 years ago

cakenggt commented 7 years ago

To recreate this bug, pull my repo here: https://github.com/cakenggt/bonsai/tree/block-missing-bug then do npm install and npm start and you can view the display on localhost:4000

To start out with, you will probably want to move back from the scene by holding down s. Every time you click in the scene, a new block is supposed to be attached to the existing tree (don't click on the existing blocks for this test, as multiple blocks get added when you do that due to some other bug). Pretty reliably, a few clicks in, you will see some of the already-added blocks disappear, which should not happen as Entities are only being added.

If you then go into aframe inspector with ctrl+alt+i, you can see the entity tree looks like this

block-bug

Notice that some of the Entities, particularly the highlighted one in the picture, have no geometry or material. However, in the react plugin for chrome, they appear to have been added normally with the correct material and geometry components.

I am unsure what the problem is, and have tried to condense the code down in that bug branch so that all of the necessary code is in app/components/treeView.jsx

ngokevin commented 7 years ago

Sorry for delay. Can you try now with v4.0.x?

ngokevin commented 7 years ago

v4 should fix. Added unit tests for attach/detaching entities with geometry/materials: https://github.com/ngokevin/aframe-react/commit/ff55a90ab4837f35f1f2832163c330b85af37b04