Closed codinghands closed 9 years ago
I'm having issues where a shape collides with multiple shapes in one update. shape:neighbours() looks like a good candidate to help here, but in the collision callback I've set up none of the objects have anything in the neighbours table.
Can you provide some minimal code example where this (neighbors()
being empty in the collision callback) happens?
Is there any way to get all collisions in a single update for easier handling?
There is no good solution to the problem since resolving one collision can solve or introduce another. Anyhow, you have basically two options:
HC:update()
HC:update()
/callbacks-mechanism, but roll your own using shape:neighbors() and shape:collidesWith()
I'm having issues where a shape collides with multiple shapes in one update. shape:neighbours() looks like a good candidate to help here, but in the collision callback I've set up none of the objects have anything in the neighbours table. Is there any way to get all collisions in a single update for easier handling?
For example, if a ball hits 2 blocks, the MTV is applied to the ball to move it, but I need to wait until all of these movements are complete until I invert the ball velocity. I believe using the 'stop' callback is insufficient as by this point the objects have moved at their old uninverted velocities, and are again colliding.