OBJExport is undefined. And missing from cdn?

Like the title says, when attempting to use the OBJExport.OBJ function the browser tells me OBJExport is undefined.

I’m using the cdn link for access to the babylon library. (without the first slash)
" </script src=“https://cdn.babylonjs.com/babylon.max.js”>"

This has worked swell untill i wanted to export out a mesh as a .obj using the code

        var obj = BABYLON.OBJExport.OBJ(array_Meshes, false, "", true)

Which is when i get the error in the browser

“Uncaught TypeError: BABYLON.OBJExport is undefined”

What seems to be the case is that the cdn link does not contain the objexport method, but i can’t find anyone discussing this issue or explaining it. Has OBJExport been removed?
I’m guessing i could solve the issue by downloading babylonjs to the computer and run it from there, but i liked using the cdn link, so any solutions?

Can add that the same problem applies to BABYLON.GLTF2Export

Ok, seems to be an issue with using the wrong serialization version. Added the link to

</script src=“https://cdn.babylonjs.com/serializers/babylonjs.serializers.min.js”>

And now OBJExport are found. The object is unusable and can’t be opened, but i feel one step closer.

1 Like

A repro in the playground would help :slight_smile:

1 Like

Hey! Yeah, i’m still struggling, but i’ve written a playground with the same issue i’m now having.

https://www.babylonjs-playground.com/#1QD8LM#13

There seems to be an issue with some and/or a combination of some meshes in the model that when exported breaks the .obj file. For example: meshCollect[0] does not work, but meshCollect[1] does. And more interestingly, meshCollect.splice(29, 31) does not work, but all of the individual meshes does work.
The problem is not that i’m unable to export a group of meshes as for example meshCollect.splice(1, 29) works

I can not make heads or tails of how to safely export the whole meshCollection. Any ideas?

This sounds like a bug to me we ll have a look shortly. Are you also seeing crashes in the console when it fails ?

This should be addressed with Fix Obj Serializer by sebavan · Pull Request #10633 · BabylonJS/Babylon.js · GitHub thanks for reporting.

1 Like