Lately I just solved something in my Application I thought I had solved already…but it came back and bit me in the “arse”, HARD!
This topic relates to the collision handler queue; or more specific, the Data Structure Pand3D uses.
I always thought collision entries were being appended to a list (list data structure), which would mean the last collision entry would be just that…in the last index of the list. This is not so.
I found out, if you want to retrieve the collision Entries in the order in which the collisions happened, you have to reverse the sequence yourself.
For instance, if you performed a loop that took every collision entry from the queue, going from index 0 to the last index of the queue, you would get a backward list using the Python Programming Language. Thus you would have to call the reverse method on the python list.
Not knowing this wasted an entire day of work for me…and caused me to pull some hair out.
Because of this I grew curious…
Can anyone tell me, what kind of data structure Panda3D is using to store the collision queue? or better yet, how that data structure works? It’s obvious data is being pushed down in a stack instead of being placed at the end of the stack.
I wish little details like this were included in the Manual where it teaches about collision queues. If the Manual would of mentioned that the data entering the collision queue was pushed down instead of placed at the end…that little info would of saved me a lot of time (and hair).
Just thought I’d mention this discovery (for me anyway) as “food for thought.” No big deal…so please don’t curse me out everyone. lol