Spatial mapping mesh orientation after LoadMesh call


I have a unity scene that does spatial mapping on a space, then in a new scene the mesh is loaded. The ZED_Rig_Stereo is carried over into the new scene in order to make the call to zedManager.LoadMesh(). However, the mesh is almost never in the same place in the scene when it is loaded. It seems to be based off of the orientation of the physical camera. I would like to know how to have the mesh be located in the same place each time the new scene is loaded.

After doing some looking around I found that ZedManager.LoadMesh() makes a call to SpatialMapping.LoadMesh() which has this line holder.transform.rotation = Quaternion.identity;. I believe this means that the scan will inherit the rotation of its parent which is the ZED_Rig_Stereo. This makes sense why the scan is orientated in the scene differently each time a new scan is created. However, after removing this line the problem still persists. I am confused as to why. Are there any other places where the orientation of the mesh is set by the ZED cameras orientation?

Hello @fallygal

Sorry for the delay. :pray:

I’m having trouble visualizing the problem, would you be able to send a video recording either here or to (referencing this post)

Are you trying to have the mesh in the same position relative to the camera (real world) or the unity scene when switching scenes?

If you’re trying to keep the mesh static relative to Unity, you could maybe save the transform of you zed_rig in scene A, and apply it to the one in scene B while also disabling the positional tracking in scene B. You should be able to call load mesh without the tracking enabled I think. (make sure area memory is off).

@JPlou No worries! Thank you for the response! I am trying to keep the mesh static relative to Unity. I have attached a sketch/diagram of what I am trying to accomplish as I can’t screen record. The arrows on the diagram just show the direction each object should be facing. The scan1/scan2 are when entering play mode and scanning the same location/environment. Let me know if anything is unclear. I will try out your suggestions and follow up with the results!