Sorting Raycasting All Hits Result

Started by
2 comments, last by Krohm 11 years, 3 months ago

Hi guys,

I'm using Bullet Raytest to get all hits in AllHitsRayResultCallback.

How do I sort the results (from the closest hit to the farthest) so If the ray hit a wall first before a vehicle, the wall should be sorted first instead of random sorting?

Advertisement

I think hits are reported in the order they happened (from closest to farthest).
Just to be sure you can sort by hit fraction.

No, Bullet physics RayTest() returns the results randomly.

Don't store the result in a Bullet-provided structure. Instead, use one of them as a base class and provide an operator<.

Store those structures in a STL container, then just std::sort it.

Previously "Krohm"

This topic is closed to new replies.

Advertisement