Hi!
I am new to BabylonJS och 3D in general, so I have started reading to make sure I go in the right direction. So bear with me.
My situation is that I have data in the form of an array with vertices, and an array with faces. For example, imagine a house with a triangle-formed roof, I will have 10 vertices and 7 faces (4 walls, 2 for the roof and 1 for the floor). The data is not triangulated. Each face may have data associated to it, for example an id, name, and much more.
I have read up on MeshBuilder.CreatePolyhedron and I can create a custom polyhedron by passing my vertices and faces as custom data.
const data = {
"name":"abc",
"category":["b"],
"vertex": myVertices,
"face": myFaces
};
const r= BABYLON.MeshBuilder.CreatePolyhedron("h" + i, {custom: data, faceColors: faceColors});
It seems that CreatePolyhedron do the triangulation, since I can pass a face with four vertices (I have not tried any more vertices).
But then it comes to identifying what face a user has clicked on.I played with the examples at: Babylon.js docs and tried PickingInfo.faceId. It did however return the id of the triangle, which is not useful for me. I want to know which one of the 7 faces was picked, so I can present the information about the face.
Is there any way to know which face (not triangle) a user has clicked on? Or am I going in the wrong direction by creating a Polyhedron, and I should instead be creating surfaces?