Jump to content

  • Log In with Google      Sign In   
  • Create Account

Sorting Raycasting All Hits Result


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 06 January 2013 - 03:44 PM

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?



Sponsor:

#2 Zaoshi Kaba   Crossbones+   -  Reputation: 4353

Like
0Likes
Like

Posted 06 January 2013 - 04:35 PM

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



#3 Medo3337   Members   -  Reputation: 665

Like
0Likes
Like

Posted 06 January 2013 - 07:07 PM

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



#4 Krohm   Crossbones+   -  Reputation: 3119

Like
0Likes
Like

Posted 07 January 2013 - 01:39 AM

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.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS