Say I want to have a setup phase in my app where I capture detailed depthData of my environment/indoor room.
Once this setup is complete I assume that the geometry of the room and larger objects in the room would not change much and generate a 3d mesh of the entire room.
After that I place a virtual object inside that mesh and allow it to randomly move in the space and observe the collisions accurately happening.
Can I somehow save and reload this depth data so that in a separate ARSession I only add on/update the existing depth data vs having to map it again?
Once this setup is complete I assume that the geometry of the room and larger objects in the room would not change much and generate a 3d mesh of the entire room.
After that I place a virtual object inside that mesh and allow it to randomly move in the space and observe the collisions accurately happening.
Can I somehow save and reload this depth data so that in a separate ARSession I only add on/update the existing depth data vs having to map it again?
Saving the depth data does not seem like the right approach. What makes more sense to me is saving the mesh which ARKit generates from the depth data. We introduced this in iOS 13.4 - you can set the ARWorldTrackingConfiguration.sceneReconstruction property to .mesh . So you could turn this on in your setup phase. Then, when setup is complete you would have to do two things:
Here is a developer sample which shows how to use the meshing feature: Visualizing and Interacting with a Reconstructed Scene
And here is a developer sample which shows how to work with ARWorldMaps: Saving and Loading World Data.
Save the mesh from all ARMeshAnchors in a 3D file format. E.g. the Wavefront OBJ format is a simple, human readable format for saving 3D geometries.
Save the current ARWorldMap via ARSession.getCurrentWorldMap
Here is a developer sample which shows how to use the meshing feature: Visualizing and Interacting with a Reconstructed Scene
And here is a developer sample which shows how to work with ARWorldMaps: Saving and Loading World Data.