I have made a 2D simulation of 20 balls enclosed within 4 walls, each with a velocity magnitude of 20 units/s, each with a mass of 1.
all rigidbodies and colliders are elastic - 0 for friction, 1for bounce.
Initial conditions
- The velocity sum along the x axis is 240.
- The velocity sum along the y axis is 160.
- The sum of |V|m was 400 (2020) at start, and I continuously printed that sum on screen, while the balls went on colliding within these 4 walls.
During runtime
- after 1 second : sum = 360
- after 10 minutes : sum = 250
- after 4 hours : sum = 0
Motivation
Why did I do this simulation? because the ball in my arkanoid-style game loses speed over time, and I wanted to find out why.
Is this due to the physics engine? shouldn’t I rely on it to be accurate enough for at least a few minutes, without a need for runtime-corrections-by-code?
I know this sum does not represent how conservation of momentum works, but I start with non-zero momentum on both axis, so the simulation should not never get to 0 speed for all 20 balls.