Change scene but keep all other default canvas properties #590
ktomanelli
started this conversation in
General
Replies: 1 comment 1 reply
-
You can dump the scene into the default scene via You can also render a scene of course, but let's see if that's what you really want |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm very new to react three fiber so this may be a silly question, but I've been looking all over the place and can't find/figure out how to properly change the scene in my project while keeping the other defaults such as camera/raycast.
So to start I'm saving a scene via scene.toJSON() and then loading that scene back in via THREE.ObjectLoader(). I'm successfully loading scene back in but this is where I'm getting a bit lost. I'd like to be able to just swap out the default scene when i want to load in my saved scene and I'm able to do this by running the following code:
useFrame(({gl})=>gl.render(props.loadedScene,camera),1)
This displays the correct scene and seems to keep my orbit and transform controls but a couple of other pieces from my default scene are gone, such as my grid helper, and the raycaster. From what I've read, that '1' in the second arg of the useFrame function removes all defaults and allows you to handle all frame updates yourself.
Does anyone have any insight on how best to update the scene without dropping the default canvas properties?
Beta Was this translation helpful? Give feedback.
All reactions