gltfLoader and objLoader not working

i’m getting errors.
for the gltfLoader

    const gltfLoader = new GLTFLoader();
    const url = '/public/assets/phone.gltf';
    gltfLoader.load(url, (gltf) => {
      const object = gltf.scene;

for the objLoader

    objLoader = new OBJLoader()
    objLoader.load('phone.obj', function(object) {
        object.position.y -= 60


i have found no working solutions on these.

Hi, it looks like you are using a project created with Create React App.

You should remove “/public” from the beginning of your URLs. The public folder content will be served at the server root.

1 Like

gotchu. if i remove public it doesn’t find my assets folder. i put my assets folder in public.

I would try visiting http://localhost:3000/assets/phone.gltf (or whatever port you’re running this on) and see what you get back. If they file is there you probably also have another issue.

1 Like

the file downloaded. so it is there. this is beyond me man. i read a solution that i didn’t really understand… someone had to go into the actual gltfloader module and change a few lines of code. but it wasn’t clear what he changed. he just said he did, lol.

another statement i found was

web server does not serve a glb but HTML content.

but had nothing else to say about it.

that’s not random, that’s the arraybuffers (meshes, vertices, …).

the correct path should be const url = ‘/assets/phone.gltf’

1 Like

you’re getting a 404 back, this is what the error messages mean. it’s trying to parse the 404 html page as gltf, so pretty certain your only issue is the path. there is nothing wrong with base64 inside gtlf’s.

1 Like

wow okay. so it was the path…? but i tried multiple different paths. so that’s annoying. but thank you to both of you for the help.

i’m guessing what i did was i tried different path so many times and maybe forgot to try it again when i put my assets into public folder. idk.