I'm trying to achieve a well known effect in platformer games where cracked blocks are destroyed when the player walks on them.
A destructible block should be destroyed only if :
The entire player hitbox touches it, OR any part of the player hitbox touches it as long as the remaining hitbox touches another destructible block.
If the player keeps running on a bridge made of destructible blocks, they should be destroyed one after the other as the player run over them (like with a 0.5s delay).
Any idea how to achieve this ?
The last picture represents what would happen if the player spawns directly on the center destructible block and if its hitbox is smaller.