Microsoft MakeCode

Mega-elastic collisions

I left some code running with some simple physics and noticed that a bouncing ball got higher. This was on a hardware device and my first guess was that it was something to do with imprecision of 32bit floating point. However, I left it running in browser and I think it degrades at a very similar rate if not identical.

Leave https://makecode.com/_53r2UfCfzJ7x running for a few minutes and you should notice the balls get higher and higher and eventually bounce off the top wall. This is in Chrome 78.0.3904.108. Would be useful if someone else could confirm this, it could just be my balls are bouncier than others.

Same on Firefox and a Pygamer, btw.

The gravity isn’t turned on until 18 seconds have passed in case that’s not obvious!

Problem occurs in both production beta 0.14.9 5.21.14 and beta beta 0.14.43 5.28.32.

FYI, I just set three other sprites in a minimal program to vx of 0.17, 0.18 and 0.19. The sprite with velocity 0.17 doesn’t move most of the time, 0.18 goes at about a 1/5 of the speed of 0.19 in the simulator.

See https://makecode.com/_iaTaDhH8Ah28 for checking different low velocities. Works well with https://www.youtube.com/watch?v=Y4QbJRAWvRU playing in the background.