I created two default cubes, and offset one of them by 2m, so that they 'touch' perfectly.

Running the following code returns an empty list:
def get_contact_polygons(self, obj1, obj2):
obj1_data = obj1.data
obj2_data = obj2.data
# Get a BMesh representation
bm1 = bmesh.new() # create an empty BMesh
bm1.from_mesh(obj1_data)
bm1.transform(obj1.matrix_world)
bm2 = bmesh.new() # create an empty BMesh
bm2.from_mesh(obj2_data)
bm2.transform(obj2.matrix_world)
tree1 = BVHTree.FromBMesh(bm1)
tree2 = BVHTree.FromBMesh(bm2)
# Returns: Returns a list of unique index pairs, the first index referencing tree1, the second referencing tree2.
return tree1.overlap(tree2)
Given that the two faces share exactly the same coordinates, I expected this to return a non-empty list. Playing around with the epsilon value also didn't help. Any help would be appreciated.
overlapis unreliable for coplanar polygons. – Markus von Broady Sep 23 '22 at 13:28