Reset camera position from outside scene #1307
-
I'm wondering what is best way to set the camera position to some point from outside the scene. I have an interface as a separate react component and I don't know how to access the camera.position from there. I just want to click an html button and have the camera get set back to its original position or some specified coordinate. Any help would be greatly appreciated! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
You're thinking bottom up, that's why it seems so complicated to you. React is fundamentally top down, there's state, then components react to it. Put the state that would define the camera position into your state model (zustand, valtio, or even just plain useState). Make the button set it, make a component within canvas listen and react to it. |
Beta Was this translation helpful? Give feedback.
You're thinking bottom up, that's why it seems so complicated to you. React is fundamentally top down, there's state, then components react to it. Put the state that would define the camera position into your state model (zustand, valtio, or even just plain useState). Make the button set it, make a component within canvas listen and react to it.