Prevent camera from resetting when shapes change - #181
Conversation
| set({ radius: sphere.radius, previousRadius: radius, top: box3.max.z }); | ||
| //eslint-disable-next-line react-hooks/exhaustive-deps | ||
| }, [children]); | ||
| }, []); |
There was a problem hiding this comment.
Thanks! I need to think about this one. I has been a while since I wrote this, but it was probably here on purpose (i.e. my guess is to have a relatively good first render).
I will try to have a look at it by the end of the week.
In any case thanks for the PRs!
There was a problem hiding this comment.
Yea I'm sure there was a reason for this but it also caused the camera to reset when the rendered shape changed. In testing so far, everything looks good.
There was a problem hiding this comment.
I think this code does not work as expected from the get go. Once the controls are initialized, this is where we should change the camera position.
That said, in theory, the camera should never change even now, which is a bug to fix (but not related to your changes I guess).
|
+1 to this feature at least. I find this quite annoying myself when using the visualizer that loads code from a local file and it moves sometimes. |
This prevents the camera from resetting when the rendered shapes change.