Map/Sprite collision resolve overshoots when sprite overlaps with multiple map collision objects
-
Sample project share 17333MND51 (probably pending)
collideMap(sprite, true) moves the sprite too far if multiple objects require the same resolution.
Consider this map:
It has two collision boxes. At the marked positions, we insert sprites (same graphics and size as the map blocks):
We let the collisions resolve:
Workarounds:
- Don't let the function resolve the collision, do that work yourself.
- If it can be tolerated to get some overlap, remember the sprite position before resolution and lerp it back to where it was if multiple collisions were resolved (as given by the size of the returned array from collideMap).
-
Thanks for the report @Z-Mann - we are aware that sprites intersecting multiple collision boxes at once can cause some issues. We'll look into your example.