Getting absolute position of picked face vertices

Hello, I again seek help with my little squared house :slight_smile:

Here, I need to find the 3 absolute positions of the vertex I just clicked.
So, I :

  • pick
  • listen to the pick.faceId
  • get all the mesh’ vertices positions (corners)
  • access the positions[faceId] index
  • access the positions[faceId+1] index
  • access the positions[faceId+2] index
  • and cry

If I loop throug all my positions array (uncomment line 70), we can see that all my corners are here, but I’m unable to deduce the three that are related to the face I’m picking.

Do someone here have an idea ?

  • how to deduce the three Vector3
  • how to achieve this in another way

well the position is

  • x = positions[faceId]
  • y = positions[faceId + 1]
  • z = positions[faceId + 2]

Also this is stored (in world space) with pick.pickedPoint

Okay for one position, but I need to find the three positions that creates the vertex.

I managed to find them !

  • Create a plane aligned according to the picked point and normal
  • Find (in the vertices positions array) those passing through the plane



Okay, but finally, this is not enough…

I’m trying to rebuild a mesh according to points passing through the plane :

:white_check_mark: I have the corners of the vertices I want
:x: I’m not able to build a customMesh with these corners
It looks that the indices (vertexData.indices = indices) I give are not in the right order or something …

How could we rebuild this indicies ?

  • click on the closest roof triangle, it’s ok
  • click on the wall with windows, and it’s not

I managed to achieve my goal at 75%. Not exactly by the way I intended :

  • create a thin box (0.00001 thickness :upside_down_face:)
  • align with picking vertex normal (don’t forget true, true ! in getNormal(true, true))
  • use CSG to grate a thin layer of the pickedMesh
  • :-1: It doesn’t work on some meshes (something with subMeshes, I guess)
  • :-1: if the mesh is curved, highlight the interior