How to import a glb file to babylon js

you can add any glb file you want

I am getting errors like this

Access to XMLHttpRequest at ‘file:///C:/xampp/htdocs/new/untitled.glb’ from origin ‘null’ has been blocked by CORS policy: Cross origin requests are only supported for protocol schemes: http, data, chrome, chrome-extension, chrome-untrusted, https, isolated-app.

logger.ts:103 BJS - [19:08:52]: Unable to load from untitled.glb: LoadFileError: Cannot read properties of null (reading ‘byteLength’)

Failed to load resource: net::ERR_FAILED

2 Likes

You can not load accross protocols (http to file) as it would be a huge security issue. This is the reason of the CORS error.

Thanks to @JohnK for pointing out the doc

2 Likes

Is the playground related in any way to your question?..
I find it odd that you get an XMLHttpRequest error when trying to load a file:// URL, because it should probably not do that. but your playground is both not working and not referencing any file

2 Likes