To get only the first intersection, use intersect.
int intersect_all(<geometry>geometry, string group, vector orig, vector dir, vector &pos, int &prim, vector &uvw, float tol=0.01, float ttol=0.01 )
When running in the context of a node (such as a wrangle SOP), this argument can be an integer representing the input number (starting at 0) to read the geometry from.
Alternatively, the argument can be a string specifying a geometry file (for example, a
.bgeo) to read from. When running inside Houdini, this can be an
If given, only intersect primitives in this group.
The ray origin point.
The ray direction and maximum distance. This function does not expect a normalized direction vector. Instead, it uses the length of the vector as the maximum distance to search.
The function overwrites this array with the world space positions of each hit.
The function overwrites this array with the primitive numbers of the primitives hit by the ray.
The function overwrites this array with the parametric UVW coordinates of where each intersection occurred on the primitive.
tol is the 3D tolerance.
ttol is the ray tolerance.
Collision points within the parametric ray tolerance,
ttol will be merged
together, often useful to avoid getting extra intersects when hitting the edges
To get all intersections without merging, set
The number of intersections, or
0 if the ray didn’t hit anything.
When intersections are performed against metaball geometry, it is impossible to determine the primitive number of the metaball which was hit. In this case, the function returns the number of primitives in the intersection geometry.