0
$\begingroup$

Related: How to check if two meshes intersect in python?

This above question answers how to know if two known objects intersect. I want to know if any objects intersect or are inside of a known mesh. There are too many objects in my scene to iterate over each one to see which one overlaps. I just need to know if any object overlaps with a given object.

Bonus: Also to know what object it is that overlaps with the given object

$\endgroup$

1 Answer 1

1
$\begingroup$

Use some kind of quick bounding box culling like this (javascript demo on collision detection by mozilla, but should be easy enough to adapt for your case) to eliminate objects that cannot overlap. Beware that Blender objects' provided bounding box is in object space, so may not be axis aligned in world space. You will need to convert it to world space and then generate a new bounding box of that bounding box that is axis aligned.

Then build bvh trees for each mesh that may intersect, and test, re-using the tree for your test object.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.