I’m trying to get physics working using facet data in my latest project. There seems to be an issue with getting the closest facet data and the projection. The projection it returns is sometimes very far away from the mesh. I think the same issue can be seen when you remove the morph from this example in the docs:
Is the definition of a facet an infinite plane? I thought a facet was a face / triangle. I also thought that the projection would be confined to that triangle.
I solved my issue after simply modifying the getClosestFacetAtLocalCoordinates function to check the distance of the facet position rather than the projected point.
I can see why the code uses the projected point. Some meshes have large and small faces. Maybe it should make sure the projected point is actually on the triangle or maybe there should be an option for that.
Thank you for tagging me. I ended up using an entirely different strategy, but it’s good to know you’ve made progress on this front, if we ever do return to it
The definition of a projection make this impossible. You are projecting a point onto a plane and it hits the plane where it hits the plane which may be outside the facet. The point and projection point form a line at right angles to the plane. It does imply this in the docs, There is only one point on the plane that does this.
This method can also compute for you the coordinates of the projection of (x, y, z) on the closest facet plane.
You found the way to do what you need so well done.
I dont see how it would be impossible. You just check if the point is on the triangle. If it isn’t you reject it. I’m talking about the algo for computing the closest facet.