Having created a 3D model with Blender, I am trying to overlay 2D text over the different meshes of the model. While I have successfully changed the colors of the meshes based on their indices using diffuse.color, I am struggling to draw text over my mesh.
Here is the code I used to change color:
scene.meshes[indexValue].material.diffuseColor = color;
allMeshChange = indexValue == scene.meshes.length - 1;
As for adding text, this is what I've tried:
var impact = scene.meshes[1];
impact.material = new BABYLON.StandardMaterial("impactMat", scene);
impact.material.emissiveColor = new BABYLON.Color3(1, 1, 0.5);
impact.position = new BABYLON.Vector3(scene.meshes[1].position);
var backgroundTexture = new BABYLON.DynamicTexture("dynamic texture", 512, scene, true);
impact.material.diffuseTexture = backgroundTexture;
impact.material.specularColor = new BABYLON.Color3(1, 1, 1);
impact.material.backFaceCulling = false;
backgroundTexture.drawText("test", null, 80, "italic 80px Segoe UI", "white", "#555555");
I am new to Babylon.js and would appreciate any help in successfully writing text over a mesh.