That snippet, and the "IntersectionAlgorithm" parts, are just the demo's way of organizing a bunch of ray casts using one of the two modes (batched, versus not batched).
You don't need to pay attention to the demo infrastructure- it boils down to one line:
I have another question.
I try to make character not attack character behind wall
So i keep list of character in hithandler.
but accord to Console.Writeline it order by mobility first
How can I get hit point?
Or make it order by what is near origin before order by mobility?
It doesn't actually order by mobility- results are reported as they are encountered during the ray traversal. The reason it appears to order by mobility is that the 'active' tree is tested first, followed by the 'static/sleeping' tree.
The RayCast does not, by itself, do any filtering or ordering. It's all programmable through the hit handler. So, to find the first impact, you can cache the closest so-far-observed impact as you traverse, modifying the maximumT value to let the traversal early-out of other parts of the tree. You can see an example in the demos Grabber: https://github.com/bepu/bepuphysics2/bl ... ber.cs#L24
The hit point is just the ray origin + ray direction * T.