pmndrs / react-three-editor

🔌 A one of a kind scene editor that writes changes back into your code
MIT License
621 stars 40 forks source link

Fix editing in the `ClickAndHover` example #40

Open krispya opened 1 year ago

krispya commented 1 year ago

This issue is for detailing problems editing in the R3F ClickAndHover example. I am picking this example because it is so basic. I am currently working off: https://github.com/pmndrs/react-three-editor/pull/39

  1. The Box2 is selectable from the scene panel but not by clicking. Inspecting, this appears to be because the ThreeEventManager is using the the presence of __r3f.editable to determine if it is an editable element. However, because the red box is added as a primitive, the intersected Mesh doesn't have __r3f.editable on it.
  2. Selecting Box.mesh, moving its position and then saving gives the following error: Uncaught TypeError: Cannot destructure property 'value' of 'input' as it is undefined.
  3. Selecting App.Box2 and attempting to move it produces the error: Uncaught TypeError: Cannot read properties of undefined (reading 'every')

More to come.

krispya commented 1 year ago

(1) was fixed with https://github.com/pmndrs/react-three-editor/pull/39/commits/2bd3b34ab8ab74983c7a8d9e0da66a8b2bff1fd3

We will definitely want to use layers now as we are traversing the scene for every hit at the moment.