Jump to content

  • Log In with Google      Sign In   
  • Create Account

FREE SOFTWARE GIVEAWAY

We have 4 x Pro Licences (valued at $59 each) for 2d modular animation software Spriter to give away in this Thursday's GDNet Direct email newsletter.


Read more in this forum topic or make sure you're signed up (from the right-hand sidebar on the homepage) and read Thursday's newsletter to get in the running!


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: 680

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: 4644

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: 680

Like
0Likes
Like

Posted 06 January 2013 - 07:07 PM

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



#4 Krohm   Crossbones+   -  Reputation: 3261

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