You can use the new hou.GadgetDrawable for locating primitives such as polygons and points instead of intersecting the geometry for a specific prim type.
Am I missing anything or both methods, the old hou.geometry().intersect() and the new hou.GadgetDrawable, return only 1 primitive under the mouse cursor? I'd like to have a list of all the prims instead. Only workaround I can think of is a convoluted implementation of a vex wrangle with the intersect_all() function.
Yeah, afaik there is no hom equivalent of intersect_all and gadgets are high level structure with the main use case of picking and dragging (so it's not designed to get intersection info).
Docs on hou.Geometry.intersect suggested this one to get all hits:
hit_positions=[]prev_dist=0.01whilegeometry.intersect(origin,direction,position,normal,uvw,min_hit=prev_dist):# Make sure to store a *copy* of the position, not the object# that is being modified in each iteration of the loophit_positions.append(hou.Vector3(position))prev_dist=origin.distanceTo(position)+0.01
You can also use hou.GeometryRayCache for that (just note that in docs signature isn't correct and missed the first argument which is geometry). Though I'm not sure if it's better in terms of performance.
Anyway this approach is probably is the same as intersect_all with 0.01 tolerance.
oh I missed that bit of code, thanks. My use case is a 2D top view, with coplanar overlapping prims. I guess I'll have to offset them in the Y according to min_hit.