Jump to content

View more

Image of the Day

「筋肉兄貴のスーパーラン!」
夕焼けにガラス・・・(´・ω・`)
ガラスは割りたいでしょうけど、割ったらクリアできないですよ。
(o・ω・o)
 #indiedev  #indiegame #screenshotsaturday https://t.co/fhKO5NJ5ee
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net's newsletters to receive the latest updates and exclusive content.


Sign up now

Sorting Raycasting All Hits Result

2: Adsense

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   

891
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?



#2 Zaoshi Kaba   Members   

8181
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   

891
Like
0Likes
Like

Posted 06 January 2013 - 07:07 PM

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



#4 MaxDZ8   Members   

4988
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.


Previously "Krohm"





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.