How do I insert a simple .glb model in react

image
Hi All,

I am trying to insert a 3D model into my scene and would love some help on how to do so!

Thanks,
Nate

Welcome to the forums!

I think you are using react-babylonJS. @brianzinn hopefully can help you with this.

welcome to the forum @natewalchenbach

You can use the Model component or the useSceneLoader hook (the hook adds more fine-grained control and the component is for convenience). For the Model you need to set rootUrl and sceneFilename. If you are using Create React App then you want them available in your public folder, which is “/” for the rootUrl. So, if you have them in /public/assets then your rootUrl is ‘assets’. If you are deploying to a subfolder then use the homepage in package.json.

There is a starter kit example here: brianzinn/create-react-app-babylonjs (github.com)

I don’t have the good internet as I’m traveling, but hopefully that gets you started.