phetsims / density-buoyancy-common

Common code for the Density and Buoyancy simulations
GNU General Public License v3.0
0 stars 2 forks source link

`contactForceInterpolatedProperty` is constantly changing, even when objects are at rest #241

Closed arouinfar closed 3 months ago

arouinfar commented 3 months ago

For https://github.com/phetsims/buoyancy/issues/51

@DianaTavares noticed that scale.measuredWeightProperty is constantly changing, even when objects appear to be at rest. The fluctuation isn't particularly small, either. It can be seen in the first decimal place, meaning it could cause the readings in the view to fluctuate. Clients collecting data from the scale are therefore collecting lots of noise, too.

The likely culprit is the contactForceInterpolatedProperty which constantly fluctuates. To see this in Studio, autoselect a block and inspect contactForceInterpolatedProperty. Move the block to the ground scale, let it sink to the bottom of the pool (if its density is large enough), and set it on the ground. No matter where it goes, the contact force is rapidly fluctuating by an excessive amount.

Assigning to the dev team to investigate.

AgustinVallejo commented 3 months ago

There was a huge discussion about this on https://github.com/phetsims/buoyancy/issues/64

TL;DR: We did our very best to fix it, and the noise has been greatly reduced, but I'm afraid any more progress on this has diminishing returns, and completely blocking the noise might not be possible. It is due to how the p2 physics engine works.

Assigning back to @arouinfar in case you see another way or to close/defer this issue.

arouinfar commented 3 months ago

Thanks @AgustinVallejo! The behavior on main is a huge improvement over what was documented in https://github.com/phetsims/buoyancy/issues/64, let's close as wont-fix.