Closed samreid closed 6 days ago
From collaboration with @zepumph
We made it to a commit point! But we are on a branch. Lots of TODOs, but in general the sim works. We mainly need to add support for Material to have its own density range, and colorProperties for Materials when they are custom.
A couple more changes coming in. Material is nicer with subtypes to handle the colors for it, but it would be good to next try to combine customColor and liquidColor into the same field. Also noting that I don't like that the subtypes have to mutate the fields to define them, but that is best so that they can be derived from the densityProperty created in the supertype.
Great progress today! All three sims fuzzed for 30 seconds in PhET brand. Next steps for next week. Most of this is already in the 50 TODOs we have linked to this issue, but I'm going to write some ordered priorities to help focus us for next time.
FluidDensityControlNode
.Patch with changes from me and @zepumph, regarding gravity and the fluid density controls.
A patch that is a bit further along. Still big questions about unit conversion for material density though it isn't needed for gravity.
We are getting quite close here. Today we merged this work onto main, and created even more side issues.
Still TODO:
Most of this issue is complete or moved to side issues. All remaining TODOs in the code are labeled for AV in the TODO. Would also be good for @zepumph to review. Self-unassigning for now.
Everything above looks good thanks. I also appreciate all the side issues. Over to @AgustinVallejo for final TODOs. (I count 6).
Adding some answers to TODO:
TODO AV: BUG: see https://github.com/phetsims/density-buoyancy-common/issues/256 there was a bug when changing the custom density of a block in screen 1. The block didn't seem to change its floating level.
Changing the custom density is not affecting the actual used material, which is wood. In fact any density change to a block which has a selected material, won't update it until it's changed to custom. Should we auto switch to custom when the density is changed via studio? Because otherwise we'd have super dense wood, would that be desirable?
Changing the custom density is not affecting the actual used material, which is wood. In fact any density change to a block which has a selected material, won't update it until it's changed to custom. Should we auto switch to custom when the density is changed via studio?
Good discovery! Maybe this is working as desired? And we need to document that the client has to also change the material to the custom one?
Good discovery! Maybe this is working as desired? And we need to document that the client has to also change the material to the custom one?
That will be determined here: https://github.com/phetsims/density-buoyancy-common/issues/273
No more todo's for this issue. Spoke with @samreid and it seems this behemoth of an issue is ready to be closed! 🥳🥳🥳
The simulation currently has multiple ways to manage the material of a solid or fluid. It is managed by a named enumeration plus a Material instance. In some, but not all cases, there is a 2-way binding. Custom materials have a separate outer Property to manage creating new Materials when the density changes. This has led to problems such as https://github.com/phetsims/density-buoyancy-common/issues/176, as well as https://github.com/phetsims/density-buoyancy-common/issues/250 as well as generally making the simulation very difficult to navigate, understand and maintain. We should attempt to preallocate all Material instances (including the custom ones) and make the density a densityProperty on the Materials in order to solve this family of problems and make the simulation much less complex in general.