I have been trying to find a fixed point in a mesh during runtime of HoloLens application (mesh is generated by Microsoft HoloLens) that I can relate to after relaunching the application, but with no success. My goal is to find a fixed point in a mesh that I will relate to when placing prefabs saved from last application run. I will use that point as origin for placing the prefabs at their previous positions in the mesh, thus displaying them where they were originally placed in the mesh.
I have tried to do the following, with incorrect results:
- save a LocalToWorld / WorldToLocal Unity4x4 Matrix of the transofrm component of SpatialMapping GameObject and perform Matrix4x4.MulitplyPoint() on positions of prefabs
- transform positions of prefabs relative to local center of the generated mesh
- transform positions of prefabs relative to local center of the first submesh
Note that I won't change the mesh (disabling update of spatial surfaces) once I place the prefabs, even in future application runs.
The only constraint is that I can't use WorldAnchors, since I need to be able to edit the position of those prefabs outside of MixedReality application (specifically in a WebGL application) and then display them at the correct edited position in the HoloLens application in the mesh.
Matrix4x4.MultiplyPoint()
. I would prefer second option because with that one you can scan, create model and transform it in Run time. – Ali KanatSpatialMappingSource
contains list ofSurfaceObjects
and each has a mesh associated with it, so they together form the model. – n0DruidsH3r3