Add 3D model using Blob object

Hello!
How can I add 3D models to Cesium using Blob object?
I dynamically generate glTF models and get theirs Blob objects
Then I try ty add it as an entity:

const pos = new Cesium.Cartesian3(x, y, z);
const orient = Cesium.Transforms.headingPitchRollQuaternion(pos, new Cesium.HeadingPitchRoll(0, -90, 0))
const entity = {
    position: pos,
    orientation: orient,
    model: {
        uri: data /** my glTF model represented as Blob */
    };
this.viewer.entities.add(entity);

But nothind is happening
I also tried to use ‘URL.createObjectURL(data).toString()’ instead ‘data’ but that didn’t help either :frowning:

1 Like

Maybe you can use Model.fromGltf method to load a glTF Resource.

Thank you for your answer!
But it turned out that URL.createObjectURL(data) works as it should, my mistake was was elsewhere in the code
So, it should be like that:

const entity = {
    position: pos,
    orientation: orient,
    model: {
        uri: URL.createObjectURL(data)
    }
};

@Vladux_Exel What is your data looks like? Is it glTF format in binary format that hold in an arraybuffer?

Yes, my models are being created using GLTFExporter.parse method

Where is your pos? Could you please show here?

Or may Resource API does not support blob? (Check Resource.isBlobSupported === true)

If me, I would save the scene to file and see it on gltf-viewer site…