Hi I would like to save my Mesh e.g. I have created sphere
<code> const geometryData = selectedShape.geometry.toJSON();
const materialData = selectedShape.material.toJSON();
const meshData = {
position: selectedShape.position,
rotation: selectedShape.rotation,
scale: selectedShape.scale
};
const mesh = JSON.stringify({
geometry: geometryData,
material: materialData,
mesh: meshData
});
localStorage.setItem('myobj',mesh);
</code>
<code> const geometryData = selectedShape.geometry.toJSON();
const materialData = selectedShape.material.toJSON();
const meshData = {
position: selectedShape.position,
rotation: selectedShape.rotation,
scale: selectedShape.scale
};
const mesh = JSON.stringify({
geometry: geometryData,
material: materialData,
mesh: meshData
});
localStorage.setItem('myobj',mesh);
</code>
const geometryData = selectedShape.geometry.toJSON();
const materialData = selectedShape.material.toJSON();
const meshData = {
position: selectedShape.position,
rotation: selectedShape.rotation,
scale: selectedShape.scale
};
const mesh = JSON.stringify({
geometry: geometryData,
material: materialData,
mesh: meshData
});
localStorage.setItem('myobj',mesh);
and to restore I am trying
<code>const mydata = localStorage.getItem('myobj');
const jsonMydata = JSON.parse(mydata);
const gg = jsonMydata.geometry;
const mm = jsonMydata.material;
let restoredMesh = Mesh(gg,mm);
scene.add(restoredMesh);
</code>
<code>const mydata = localStorage.getItem('myobj');
const jsonMydata = JSON.parse(mydata);
const gg = jsonMydata.geometry;
const mm = jsonMydata.material;
let restoredMesh = Mesh(gg,mm);
scene.add(restoredMesh);
</code>
const mydata = localStorage.getItem('myobj');
const jsonMydata = JSON.parse(mydata);
const gg = jsonMydata.geometry;
const mm = jsonMydata.material;
let restoredMesh = Mesh(gg,mm);
scene.add(restoredMesh);
But I am not able to retore with this. Could someone suggest how to save Mesh with geometry and material and restore it? Thank you!