Ray3d examples?

Hi,

Are there any examples and/or workflows regarding creating rays and getting information about the hit object(s) or the coordinates of the hit(s)?

Thanks in advance.

This discussion

should get you started.

1 Like

Thanks I think I figured it out:

def SHMUP(ray_gun=None, target=None):
    if ray_gun is None or target is None: return
    centroid = get_centroid(ray_gun)
    vector = Rhino.Geometry.Vector3d.ZAxis
    ray = Rhino.Geometry.Ray3d(centroid, vector)
    hits = Rhino.Geometry.Intersect.Intersection.RayShoot(ray,[target], 1)
    dist = centroid.DistanceTo(hits[0])
    
    return dist

Hey, the ray can “bounce” :smiley: that’s cool.