Can I determine by way of a python script whether two objects are intersecting. Preferably a sphere and a randomly shaped object.
Replying to my own post to put it back on the top part of the list, I am still struggling with this.
Yes, but you have to do it yourself (ie Blender doesn’t export any collision detection functions to python.)
This, of course, is not easy, so check out something like OPCODE & ODE, which can do Sphere<->Mesh collision detection.
Good Luck.
PS, if you want to do eg. Sphere<->Box or Sphere<->Sphere or Box<->Box, this is a lot easier.
my own pps!
should still be fairly easy if you just want to check if any vertex of an object is inside a sphere or box. A bit more tricky if you want to check whether any edge is intersecting a sphere or box, and more tricky again if you want to check whether any face is intersecting a sphere or box!
you could do the first (vertex => sphere) just by checking each vertex to see if the distance to the centre of the sphere is less than the radius of the sphere. Similar with the box…
A little edit: found this site which has C code checking whether a triangle (could be a face of your object) intersects a sphere. Would take some decoding though, which my programming skills aren’t up to I’m afraid!
Many thanks, that points me down a more productive path.