So, I built a simple physics engine (without rotation as of now)
You can click and then release to create block with velocity.
Now, I want to apply force at the bottom most block. Currently, the block will only slide without affecting the other top blocks.
Now, I can only think of a simple algorithm to make all the top blocks slide when the bottom one slides which goes like this,
- shift the current block
- find the blocks on top that touch the current block,
- recurse each such block and goto step 1
But there are problems with this algorithm(double additions for example, but easy to fix with a boolean flag).
So guys, how do I make all top blocks slide when the bottom one moves?