Hi there,
For my product configurator i implemented a way to switch between different models with the javascript switch function:
export const ModelSwitch = () => {
const Model = useModelStore((state) => state.Model);
switch (Model) {
case "Handle":
return <Handle />;
case "Knob":
return <Knob />;
default:
return <></>;
}
};
This works fine, the problem is that i have alot of models and i can’t load all models upfront with useGLTF.preload(). So when switching between models there is a small whitescreen because the model is getting loaded. How can i get rid of this? I imagine something like only replace if the other model is loaded, or better show some loading ui in between so the user sees what is goin on (i tried adding a loading screen with suspense, but i cant insert html into the canvas…).
Here is a Codesandbox showing my problem: https://codesandbox.io/p/devbox/modelswitchtest-vzwp4l
On the first model switch there is the whitescreen. When the model is loaded it’s gone obviously.
Thanks for any idea or direction i can search for, Tom