Get position of a mesh

I have loaded a mesh with numbers and letters and would like to compile my own text from it.

I have mapped the digits as an example.

The positions of the meshes are all set to zero,
but when I attach the individual digits to each other, they have different spacing.

I can’t figure out why.

 const result = await BABYLON.SceneLoader.ImportMeshAsync(null, "./media/letters/", "letters.obj", scene);

let letters = {};
            letters["0"] = scene.getMeshByName("Mesh10 G_12345_67890_1_1 Model");
            letters["1"] = scene.getMeshByName("Mesh1 G_12345_67890_1_1 Model");
            letters["2"] = scene.getMeshByName("Mesh2 G_12345_67890_1_1 Model");
            letters["3"] = scene.getMeshByName("Mesh3 G_12345_67890_1_1 Model");
            letters["4"] = scene.getMeshByName("Mesh4 G_12345_67890_1_1 Model");
            letters["5"] = scene.getMeshByName("Mesh5 G_12345_67890_1_1 Model");
            letters["6"] = scene.getMeshByName("Mesh6 G_12345_67890_1_1 Model");
            letters["7"] = scene.getMeshByName("Mesh7 G_12345_67890_1_1 Model");
            letters["8"] = scene.getMeshByName("Mesh8 G_12345_67890_1_1 Model");
            letters["9"] = scene.getMeshByName("Mesh9 G_12345_67890_1_1 Model");

            let text = "31415";
            let pos = new BABYLON.Vector3(0, 0, -2);

            let colorEdge = new BABYLON.Color4(0, 0, 1, 1);
            let instanceId = 0;

            // left aligned

            for (let i = 0; i < text.length; i++) {
                let char = text.charAt(i);
                let mesh = letters[char].createInstance(instanceId++);
                mesh.position.copyFrom(pos);
                mesh.position.x = pos.x + i * 0.5;
            }


letters.zip (399.6 KB)

Probably you need to try mesh.absolutePosition?

I suppose this obj-file is not fully supported. I’m going to fix the y-coord manually in my exported letter-mesh-obj-file. thank yu! :slight_smile: