Access mesh data after serializing the scene

Hi everybody,
I created a 3D environment where I can import multiple meshes and move them in the scene. But I want to be able to save the scene after I make the modification on meshes’ transfromation values and access the updated values. What I can do now is to serialize the scene and save as .babylon format. However .babylon format stores all the data about scene in JSON format but I need just the last position, rotation and scale values of all meshes in the scene. I would appreciate any help to lead me to solution. What I have right now is:

Thank you in advance! :slight_smile:

Form a data object with the data you require and stringify it as a JSON object which you can then save and parse on load. You will of course need your own save and load routines.

1 Like

Thank you so much for your help. But I am not sure if I understand fully. Could you check the playground:

I am trying to go all myMesh array and store position of meshes and when I click the button, it saves as a text file. However, the problem position values stored in myMesh array is null. What could be the reason for that? I am stuck at this point. Once I ll able to create txt file properly, I ll have to serialize the scene and update the file with the changes.

Hi it’s because you are creating result (line 166) before loading is complete (line 16) .

Move the code in the button handler (line 152) and it works :

1 Like

Main problem is that result is filled before your files have finished loading.

You could move the result code into button event

or you could use the scene.meshes array