SOLVED [Beginner:Python] Turn object into a point selection bounding box

Hi, I would like to know how to turn any editable or parametric object (geometry) into a selection bounding box, mainly to assign vertex weight, similar to joint weight shape falloff option. Thank you!

Hi joe_curwen, thanks for reaching out us.

With regard to your question, can you please elaborate more? It's not completely clear what you're attempting to achieve and we can't be of any support with more information.

Are you thinking to use a generic geometry as a some sort of 'live selectio' tool to select all the points (of other scene entities) that are intersected by this "selecting" geometry? Or what?

Best, Riccardo

@r_gigante That's exactly right, it would be a live selection tool, a piece of geometry to be intersected with other entities in the scene, the intersecting vertex points would be assigned a vertex weight, although with just selecting said intersecting point would be enough. Thank you Riccardo!

Hello @joe_curwen ,

There's not too much in our SDK that will help you doing this. You have to find an algorithm for that.
Your algorithm will depend on how many points you have to check. (you can even implement several)

Questions you have to think about before implementing something :

  • how complex are your objects ? (sphere, cube, convex mesh, non-convex mesh, close, open)
  • how many points there is in both object ?
  • how robust you want your tool to be ?

Some examples :

Sphere collision can be simple enough, it's fast you just compare a distance between the center of the sphere and the point to know if the point is inside the sphere.

Cube or Bounding Box collision is pretty easy and fast (AABB algorithm for example)

For more complicate geometry you can use the ray collider
It's basic, for each point, you cast a ray (what ever direction, but long enough) and you count the number of collision you have. If it's odd, you are inside the mesh, if it's even or none you are outside.
(I used once this and i remember having issue if a ray hit exactly a point and return every polygon attached to that point as a "collision", so you end up with false number of collision)

For high number of points, you have to get a region first, using a bounding box selection and rays or using a KD-Tree. (we have kd-tree in c++ but not in python).

Hope it help


If you have nothing to add, this thread will be considered as "solved" tomorrow.