I’m trying to obtain all intersection points between a line and a mesh by using the line trace functions. In a simple scenario with two cubes, the line trace functions only return the first hit on each cube’s component. For example, if a line passes through the front and back face of a cube, it only returns the first hit (e.g., the front face) and then continues to return the first hit on the second cube. How can I retrieve all the intersection points?

some one suggested using the first result to construct a second line trace to obtain all the points, but once inside the cube, the trace function doesn’t return anything. Additionally, some one mentioned tracing again from the back, which might work for a cube but not for more complex polyhedrons.

Do you have any ideas to address this issue, or should I explore alternatives to the line trace functions as it may not be the right approach?

Below are the images illustrating the situation. As you can see, the two front faces are hit but the back faces are not checked.