Selecting a Face of Cube

Yes, that was exactly what I was asking for. Thank you

But this not works for spheres with segmentation more than 1! :frowning:

image

Identifying Flat Edged Surfaces | Babylon.js Playground (babylonjs.com)

@CodingCrusader That was my original question. With a shape that you provided. You can clearly see that there are 2 facets on each face of the hexagon. I need the ability to pick anywhere inside that 2 facet area, and have it highlight both facets. The sample that you provided seems like it is coloring above and below. Here’s an example.

Lets say I select a point on the shape
picked point

and now it highlights the selected face
selected face

You need to convert your mesh to flat shaded mesh. I forgot to add that line in playground. :sweat_smile:
The colour gradient kind of effect is occurring because of shared vertices.

Thought you done it @Akshat_Agrawal but you didn’t.
Isn’t it insane how hard that is?

It seems the way to go is checking the normals but i did not try yet.

box.convertToFlatShadedMesh(); didn’t work either. How did you convert the to flat shaded mesh?

It looks like you guys have it worked out, but I’m going to chime in.
The hard part of this problem may be how to define the so-called faces.

From a practical point of view, if it means the face of the glb model derived from blender.

It looks like blender gives them a shared index when trigonometrizing them.

So, a simple search for faces with shared indexes would be sufficient for most cases.

So, I made a very simple implementation, which is less than 60 lines with the scene code.

Translated with DeepL

1 Like

box.convertToFlatShadedMesh() is working, see pg

1 Like

Sorry to contradict you, but no, it doesn’t work. in germany at least :slight_smile:

“in germany at least” Is this a meme?
XR6T$0VAC{AX2)IK%SABRS

My English is not very good, dIs it true that this does not work in Germany?

1 Like

What is a “meme”?

:smiley: … no, the part with Germany was a joke. The fact is: convertToFlatShadedMesh is not working. I can select only the facets in the middle of the sphere.

meme and joke are probably close synonyms. I don’t know, the translation software taught me.

The fact that the top surface is not selected may have something to do with its implementation, but not with convertToFlatShadedMesh.

He tells you to use convertToFlatShadedMesh() just to solve the problem of color overflow on the selected faces.

He may have skipped the non-quad faces.

I found a definition of “meme” in wikipedia. My attention was just to make you smile.

R (1)

2 Likes

YC$P5N~KK~PR`ZNAVMN5Z$Y

3 Likes

I implemented a “Face-Center-Highlighter” and used your suggestions with comparing the normals

But I am still not sure if the results are ok for the sphere mesh that @CodingCrusader mentioned. Seems I do not detect the faces in the bottom part correctly… :thinking:

1 Like