sprite->moveWithCollisions is unstable and can crash at least the simulator even with included sprite collisions demo

Hi,

sprite->moveWithCollisions seems to be unstable and cause crashes or can at least make simulator crash. I’ve tried using latest 3.0.3 sdk and builded an example (that will crash) based on the sprite collision demo with a specific set of blocks instead of random blocks to make it crash 100% of the time at the same spot, with the cause of the crash situated in moveWithCollisions. I have found multiple ways to make it crash in other situations as well but for easy testing and reproduction i have based myself on the included “sprite collisions” example of the C API.

to Make it crash comment the random “blocks” creations and replace it with the following in setupGame

/*
for ( i = 0; i < 6; i++ )
{
createBlock((rand() % 270) + 50,
(rand() % 100) + 50,
(rand() % 30) + 10,
(rand() % 90) + 10);
}
*/
createBlock(120,68,30,67);
createBlock(318,70,21,38);
createBlock(253,82,21,49);
createBlock(140,110,32,58);
createBlock(64,57,39,27);
createBlock(110,109,30,63);

Compile it for simualtor, it does not matter if you used visual studio or gcc and leave it running for around 5 minutes and you’ll notice it’ll crash always on some spot and the stacktrace shows the crash happening in the movewithcollisions function.

From what i’ve noticed the crashes mostly happen with “bounce” resolve type when the blocks get cornered into walls and the other block, as per this screenshot (exact moment it crashed)

but as said i’ve found many other situations where it also crashes (other configs)

just run that sprite colllision demo with the example above and you’ll be able to reproduce it.

It happens on playdate itself also