This is a follow up to How to check if two meshes intersect in python with BVH Tree?
It appears that just calling overlap() on the BVH tree of two objects is not enough. Some sort of bmesh transform is required (this part confuses the hell out of me). I tried this in the code below, however I am still getting intersection on every object even if they are all not touching..
#delete objects that are intersecting
def delInter():
#check every object for intersection with every other object
for obj_now in obj_list:
for obj_next in obj_list:
print()
if obj_now == obj_next:
continue
#create bmesh objects
bm1 = bmesh.new()
bm2 = bmesh.new()
#fill bmesh data from objects
bm1.from_mesh(scene.objects[obj_now].data)
bm2.from_mesh(scene.objects[obj_next].data)
#fixed it here:
bm1.transform(scene.objects[obj_now].matrix_world)
bm2.transform(scene.objects[obj_next].matrix_world)
#make BVH tree from BMesh of objects
obj_now_BVHtree = BVHTree.FromBMesh(bm1)
obj_next_BVHtree = BVHTree.FromBMesh(bm2)
#get intersecting pairs
inter = obj_now_BVHtree.overlap(obj_next_BVHtree)
#if list is empty, no objects are touching
if inter != []:
print(obj_now + " and " + obj_next + " are touching!")
else:
print(obj_now + " and " + obj_next + " NOT touching!")