project-viable / viable-virtual-lab

Simulation framework to provide a virtual lab experience to teach research
https://project-viable.github.io/viable-virtual-lab/export/VirtualLabExport.html
Other
1 stars 0 forks source link

Weight of objects is potentially computed incorrectly #76

Open jwtay1 opened 3 months ago

jwtay1 commented 3 months ago

Weight of objects and their contents seem to be computed/stored in an odd way - they are converted first into a volume, then somehow coverted back into mass. This is a bit confusing and I think requires a re-factor.

On that note: The current object weight is being stored in the RigidBody2D weight parameter. This is fine (?) but could in the future conflict with the 2D physics engine that operates on these objects. I think it would be better if we just pull out this variable and handle weight separately.

jcourt325 commented 2 months ago

The reason that it uses the RigidBody mass parameter is actually for consistency with the physics engine.

This is less of a concern now because, as far as I'm aware, we don't actually let the physics system really do anything (all our objects are in kinematic mode), but previousely we thought that we should be using the same property because that way, a change in an object's mass from our code (for example, by adding liquid to a flask) would also affect the way it behaved physically. So its behavior would match its actual state.

I think this is less of a concern than we originally thought, but I think adding a separate parameter for each labobject to set would be confusing, since it would maybe get unclear what affected what. If we do add a separate labobjectMass property or anything, I think we should at least use setget so that the rigidbody mass parameter always matches it?

jcourt325 commented 2 months ago

For the first thing, about Volumes - I think this was an intentional choice made during the fall. I'm pretty sure that either substance.gd or the documentation page for Substances mentions it, but I'm not sure which.

I think the reasoning was that we don't think of some substances as masses, but we always know the volume, or something? For example, we get 50ml of buffer, and we don't think of it as a mass of the substance because we're just "filling the container" or something. I'm not quite sure if I agree with that reasoning. I think it's worth looking in to if there's time.