In Chrome, the fourth box from the top starts sliding when it hits the floor, pushing the box to the right clear off the floor box. Every box eventually slides along the floor and falls into the pit.
In Firefox, the fourth from the top stays put. It never pushes the box on the right, though all the rest eventually slide into the pit.
I think the "neither instance seems to actually make physical sense" is due to a lack of friction.
Friction is a biggie that I need to add ASAP!
Edit: yup, it's the same every time per browser, but I can have e.g. Edge and Chrome running next to one another doing different things.
Floating point is completely deterministic (as you note by getting the same behavior every time you run the simulation in the browser). I'm looking at the js spec, and there shouldn't be any freedom in evaluating floating point expressions (but overly clever browser vendors may have ignored that and reordered them anyhow).
However, I do know for a fact that the implementations of the Math.sin and Math.cos functions are browser specific,
https://tc39.github.io/ecma262/#sec-math.sin
so that alone will remove any chance at browser independent reproducibility, without additional controls.
Be interesting to see if replacing Math.cos and Math.sin with your own implementation would remove the cross browser dependency.
Btw, spec conforming implementation of Math.sin
function sin(x) {
if ( x === Infinity
|| x === -Infinity
|| x === NaN) {
return NaN;
}
return x;
}You can look at the source code and see if that's what it's doing.
So you want to change the simulation? Change the initial setup.
This is obviously not user friendly, but I'm not sure how you can possibly suggest this is not a simulation.
Having always the same animation helps debugging. But yeah I should have added the option to add a mouse!