Gltf loader/exporter convert all groups to object3d

During exportation/importation of a scene in gltf format, so using gltf.exporter/loader all the groups in my scene are converted in objectd3d.
Now since i base my script on the difference between group and object3d this is a problem for me.
How can i change this beahviour?
Or, as a last resort, is there a way to convert object3d to group without moving all elements from one to the other?
Thank you.

The glTF format does not have all of three.js’s class types, so that information is lost during serialization.

An alternative would be to put something in object.userData like this:

object.userData.myCustomType = 'group';

That data will be preserved after export/import, but it will still be an Object3D. If you want to convert it you will have to create a new Group and move the children from one to the other.

3 Likes

Thanks for the answer. I will use your solution.