Hi I tried to use the above playground example to drag and drop a mesh to load it. It’s not my example but it seems to work. My question is however; when the file has been loaded, how do I get access to the mesh for example? Like say I want to load the file and then set the position to a certain value?
I would use BABYLON.SceneLoader.ImportMesh
instead of BABYLON.SceneLoader.AppendAsync
The onSuccess
callback of ImportMesh
has a meshes argument that references the models you just loaded.
Ah ok, thanks!
What would you use for fetching a dropped image? Like if you want to drop a hdr cube map?
I am sorry, I am pretty new to Babylon. That site you gave me only seem to show how to use a local resource as cube map.
I still don’t understand how I can use the “file” I get from the BABYLON.FilesInput and then convert/use/whatever to be the new cube map?
What are you trying to do @ChoArrim ? as there are several ways for everything so let s see what best fit. not sure where the input is coming from in the thread ?
Sorry if I am being vague. I know how to create a cubemap with a local resource and also enable the drag and drop file handler and now I know how I can drag and drop a mesh file onto the canvas and then store that mesh for future changes.
What I am now trying to understand is how I can drag a, for example a .env file, to the canvas and fetch that file and use it as a cubemap.
I hope I have made a better explanation of what I am trying to understand.
I believe one of the best ways to understand it is to see how it is done at the Sandbox - Babylon.js/environmentTools.ts at master · BabylonJS/Babylon.js · GitHub
This is how we hook it in the files input in the sandbox: Babylon.js/renderingZone.tsx at master · BabylonJS/Babylon.js · GitHub