Keep positions of exported models

In my app, i am able to export and import gltf models. When exporting f.e. 3 same gltf models with different position, rotation and scale with these options:

    var options = {
				trs: true,
				onlyVisible: true,
				truncateDrawRange: true,
				binary: false,
				//animations: ,
				forceIndices: false,
				forcePowerOfTwoTextures: false,
				maxTextureSize: Infinity

and import them again, i will import the 3 gltf models but all with position 0,0,0, rotation 0,0,0 and scale 1,1,1.
How can i keep the attributes? I thought trs enabled keeps these attributes…
Btw.: I made sure i didn’t overwrite the attributes after importing them. So the problem has to be one with exporting these objects.

Can you please demonstrate the issue with a live example? Just posting your exporter options is unfortunately not sufficient to debug the issue.

Unfortunately i cannot publish my code, but i can share my whole export and import functions. Also i am not sure how to demonstrate the problem on fiddle. The information gets lost when exporting i think…
Here is my import code:
loader = new GLTFLoader();

					var dracoLoader = new DRACOLoader();

					loader.setDDSLoader(new DDSLoader());

					url = sceneInfo.url;
					loader.load(url, function(data){
						var j, gltf = data;
						for (j=0;j<gltf.scenes.length;j++)
							object = gltf.scenes[j];
							console.log(object.position);        //output 0,0,0
							console.log(object.rotation);        //output 0,0,0
							console.log(object.scale);           //output 1,1,1			 =;


Export code:

    exportScene: function(){
				var objectArray = [];
				var i;

				for (i=0;i<createdObjects.length;i++)
					objectArray[i] = scene.getObjectById(createdObjects[i]); 

So i understand correctly this correctly?: If trs is enabled, a model should keep its position rotation and scale, correct?

It means the transformation is saved as three distinct entities: position, rotation and scale. If it is false, the local matrix is saved instead (meaning Object3D.matrix). These are just two different ways to define the transformation of a glTF node.

1 Like

So the actual world position, rotation and scale in the scene of the object will not get saved with trs enabled? So i would have to save this data in another way…