[SOLVED] Cannot load GLB asset from a URL

Hi, Guys I am trying to load a glb file
https://threejs.org/examples/models/gltf/Soldier.glb
using Ajax GET call, I get the file in binary format, then I am converting to blob and a url.
But I am getting this error:

Invalid length found in glb header. Found 3183472468
Project:
https://playcanvas.com/editor/scene/952360

Script:
https://playcanvas.com/editor/code/701282?tabs=32753104

I have to load the glb file in this specific manner because I have to do a Ajax call with the authentication header then I get the file (in the main project) in this binary format.

Hi @Saad_Haider,

Not sure, but I think the issue here is that your initial Ajax request is returning text not binary.

You need to configure the jQuery ajax request to have the response type as binary or arraybuffer.

2 Likes

Thanks @Leonidas

Issue has been resolved, it was indeed the response type issue.

1 Like