How does MakeJoints work?

So I’m trying to create an adjacent parts detector. I noticed that :MakeJoints works almost exactly how I need. It seems to check for parts in only 6 directions, excluding diagonally adjacent parts.

Anyone has some ideas how it might work? Maybe a dev can help me out? Not sure whether it’s region3 check or something else. :GetTouchingParts is out since it only check for intersections and creating 3 temporary parts to check it sounds like bad thing to do performance wise

no It doesn’t really tell anything about the way it detects parts with compatible surfaces and that’s the only thing I need.

Alternatively can anyone suggest what’d be the best way to check adjacent parts but not those that connect perfectly diagonal?