How to count rayCast found shape

I want to get count of found shapes by rayCast. Is it possible?

I think it should be possible because the point of the ray cast is knowing when an object is in the path of the ray. What do you have so far? I think that you could always implement a simple counter to tell you.

Edit: I looked in cpp-tests and it looks like you could always do this in the callback:

PhysicsRayCastCallbackFunc func = [&points, &num](PhysicsWorld& /*world*/, const PhysicsRayCastInfo& info, void* /*data*/)->bool
 {
     // do something here

     return true;
 };           

I also think a rect query might be helpful here. Combine the 2 concepts.

Thank you very much