Get all geometry under raycast?

All the ray-casting methods are indeed designed to only return first hit object. There are specific optimizations inside for this use-case, since it is the most common need.

To query everything, you can repeat the query, shifting RayOrigin (position at which the ray starts) each time. This is similar to what I described in this post: Convenient way to determine exact point under mouse - #4 by michalis , albeit that was for a bit different task (to avoid detecting hits on transparent pixels).

So:

  • Use MyViewport.CameraRayCollision(RayOrigin, RayDirection) . It returns TRayCollision, just like MouseRayHit (so it can be processed in the same way as above to detect the particular point). It takes as input ray position and direction.

  • Use it in a loop.

    • The initial RayOrigin, RayDirection can come from the mouse position – use MyViewport.PositionToRay.

    • Make a call to MyViewport.CameraRayCollision(RayOrigin, RayDirection). If something was hit, add it to the list, and make another call to MyViewport.CameraRayCollision(NewRayOrigin, RayDirection). The NewRayOrigin can be calculated like

    NewRayOrigin := HitPosition + RayDirection.AdjustToLength(SomeEpsilon)