I’m new to Babylon.js and have decided to create a 3D object for my website using this technology. I’m working on a cylinder with the functionality to select a face by clicking on it. When a face is clicked, I want its color to change and its face ID to be displayed in a text box.
Currently, I’m facing an issue with assigning numbers to each face ID. I’m not sure how to correctly map these numbers to the faces. Does anyone have any ideas on how to achieve this?
You don’t need to create the engine, it’s already existing within the Playground context. You only need to define the createScene() function
scene was not defined in addClickAction()
For automatic rotation of the text meshes toward camera, you can use the billboard mode (see in the updated playground line 183.
In my playground line 181 plane.bakeCurrentTransformIntoVertices(); is a trick to offset the plane regarding its center, so that the billboard mode automatically ads the right offset
Now it’s amazing. I see your function getBarycenter and I understand where the issue was. Thank you very much for the explanation and for helping me. You are the best!