Hello everyone.

The Mixed Reality Forums here are no longer being used or maintained.

There are a few other places we would like to direct you to for support, both from Microsoft and from the community.

The first way we want to connect with you is our mixed reality developer program, which you can sign up for at https://aka.ms/IWantMR.

For technical questions, please use Stack Overflow, and tag your questions using either hololens or windows-mixed-reality.

If you want to join in discussions, please do so in the HoloDevelopers Slack, which you can join by going to https://aka.ms/holodevelopers, or in our Microsoft Tech Communities forums at https://techcommunity.microsoft.com/t5/mixed-reality/ct-p/MicrosoftMixedReality.

And always feel free to hit us up on Twitter @MxdRealityDev.

Mesh Data and .obj File from 3D View do not align

Hello everybody,

for my Bachelor Thesis I wrote an App that saves the Meshes form the Hololens to an .xyz File (Code below).

I wanted to compare it to the .obj File I can download from the Device Portal under 3D-View, but they are rotated to each other. Even when the Hololens stays at the same pose, while I save the Meshes with my code and afterwards with the Device Portal, they do not align.

Can someone explain this to me? Sadly I did not find the Code for the 3D-View in the Device Portal to look myself for the solution.

        //DEBUG variable Once
        //once = false;

        string vertices_xyz = "";
        List<MeshFilter> meshfilters = SpatialMappingManager.Instance.GetMeshFilters();

        string fileName = "WholeMesh.xyz";
        string path = Path.Combine(Application.persistentDataPath, fileName);
        TextWriter writer = File.CreateText(path);

        for (int i = 0; i < meshfilters.Count; i++) {

            Mesh mesh = meshfilters[i].sharedMesh;
            //string debugs = "Vertices in Mesh " + i + ": " + mesh.vertexCount + System.Environment.NewLine;
            Vector3[] vertices = mesh.vertices;
            Transform transform = meshfilters[i].transform;
            for (int v = 0, vLength = vertices.Length; v < vLength; ++v)
            {
                Vector3 vertex = transform.TransformPoint(vertices[v]);

                vertices_xyz += vertex.x + " " + vertex.y + " " + vertex.z + System.Environment.NewLine;
            }    
            writer.Write(vertices_xyz);
            Debug.Log(String.Format("Now save Mesh {0}", i));
        }
        Debug.Log("The whole Mesh was saved. Writer shuts down.");
        writer.Dispose();
Sign In or Register to comment.