Mesh facets - Box selection

Hello anyone!

What is the best approach to find what mesh facets is inside selecting rectangle, that is drawn by mouse down and move?

I need something like selection box in three.js (three.js webgl - box selection), but I need to select mesh facets.

Thanks for any suggestions.

Hey @vistratov,

I think this is what you’re after. Hopefully it’s helpful!

Hello @PirateJC. The link is outdated. Maybe during this time there was some kind of demo?

@Nawar thanks for flagging this! I just updated the link to the correct page! Sorry about that!

1 Like

Thank you. But it’s not very clear how to use this facetData to create a demo.

Maybe someone has already done this and somewhere there is a forgotten but necessary playground?

1 Marquee selection demo
2 2D rectangle to select - #3 by msDestiny14
3 Examples from the playground - #921 by gsanta

Here is a playground based on the third example. In this way, you can select specific points on the mesh. You can look at the console and see how many faces the mesh has and how many faces are inside the select box. The facetInsideRect array stores the facets ids that were selected using the select box.


Now I need the select box to somehow work correctly with the Z coordinate. Does anyone have any idea?