Quantum Collision Issues Followup
So, remember those quantum collision issues I had recently? I managed to somehow fix them _without_ hiring an exorcist. For those interested, the problem was in the order and way collisions were handled.
All objects that collide with blocks and other solid entities are stored in a list. The collision check simply goes down that list and checks if an object is colliding with the block. So far so good. However, after some testing I found that if an object is colliding with a block, the collision for the next objects in the list won't be handled; simply put, only one object was able to properly collide with a block, and whatever object came first in the list got the honor of getting proper collision detection.
This also explains this mysterious .gif:
The barrel I'm throwing on the block is higher in the list than the left barrel, so the moment the thrown barrel collides with the block, the left barrel's collision isn't handled any more and it drops to the ground. And no, I'm not sure how I've never stumbled upon that during testing until recently.
So, what caused this behavior? To be honest I don't know. I was using HaxeFlixel's built-in `collide()`function which checks for a collision and then separates the two objects if necessary, but as you can see it didn't seem to detect multiple collisions in this case. Once I simply replaced the function with my own (which forced the separation without checking first) everything worked as intended.
I might dig deeper into the HF codebase to try and figure out what exactly happened, as I'm pretty sure I just did something wrong. But at least I managed to fix it for now...
Leave a comment
Log in with your itch.io account to leave a comment.