I have yet another question. Hopefully these aren't getting annoying...
Suppose I have the following setup: Three boxes A, B, and C are arranged on a flat surface so that they're right next to each other. The three boxes have different masses, call them m1, m2, m3, and different friction constants, call them f1, f2, and f3. The ground has friction 1.0. All elasticity constants are set to 0. All boxes have infinite moments of inertia so they never rotate. This setup is shown in this drawing:
- drawing.png (2.4 KiB) Viewed 7116 times
Now I apply a constant force F to box A. My expectation is that the three boxes will move as if they are a single body with mass M = (m1 + m2 + m3). Furthermore, I would expect the total force acting on this setup to be:
F' = F - G * (f1 * m1 + f2 * m2 + f3 * m3)
where G is the gravity constant. This is just the pushing force minus the frictional force experienced by each box. The total acceleration experienced by the system should be F' / M.
I tried to replicate this setup in chipmunk, and the acceleration I measure in the simulation is close to my calculation, but still significantly different (by about 0.0002 for the values I used). I'm not using this for a game, so the small difference matters.
My question is, is the difference due to my calculation being too naive, or imperfections in the simulation? If the latter, what parameters can I tune to get the difference to be smaller?
I'm already running the simulation with collision iterations set to 100, and collision slop and bias set to 1e-7. I'm also running with a very small step duration (1e-5). Decreasing any of these parameters doesn't seem to decrease the difference between the measured acceleration and my calculation. I've also tried putting 0-length joint constraints between the boxes, but that made the situation much worse, as it seemed to build energy as the simulation progressed.
Any suggestions would be appreciated. Thanks for your help!