In this PG http://www.babylonjs-playground.com/#N4TFF I get lots of things I do not expect. Probably because I do not fully understand what I am doing or what I should expect, or maybe not!
The little boxes indicate the points at which I am trying to find the closest facet.
My expectations.
Using show partitions would show partitions that would match the shape of the mesh.
Using the values for (x, y, z) given they would all return an index as they are all close to the mesh. (See console results for box2 and box4)
Different positions of (x, y, z) would return different index numbers. (see console results for box1 and box3)
The projected variable would be non zero.
Sorry @jerome but I think this is just for you.
Am I missing the point somewhere and doing something wrong (most likely)? Is it because I am using an extruded mesh with a few large facets?