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.


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

Hey again! The problem should as you say be adressed in the fix you implemented. However, the export still seems to fail?

Using the same playground link, the error now is:

babylonjs.serializers.min.js:1 Uncaught TypeError: e[u].computeWorldMatrix is not a function
at Function.e.OBJ (babylonjs.serializers.min.js:1)
at r.callback (:61:45)
at e.notifyObservers (babylon.js:16)
at e.t._onPointerUp (babylon.gui.min.js:16)
at e._onPointerUp (babylon.gui.min.js:16)
at e.t._processObservables (babylon.gui.min.js:16)
at e._processPicking (babylon.gui.min.js:16)
at e._processPicking (babylon.gui.min.js:16)
at e._doPicking (babylon.gui.min.js:16)
at r.callback (babylon.gui.min.js:16)

Which seems to be an exporter bug?

OK it seems to be working! Changed the mesh input of the BABYLON.OBJEXPORT.OBJ[mesh] from being the colleciton of meshes inside another list, to just being the list of meshes and it ran quick and efficiently. Awesome!
Here’s the working playground: (You may need to change the model imported as i remove my git model)


1 Like