Fire Changed signals for BasePart.AssemblyMass

As a Roblox developer, it is currently too hard to keep track of assembly mass for use with dynamically created constraints. Currently, a change in an assemblies mass does not appear to fire any signals, just like with other assembly properties.

If Roblox is able to address this issue, it would improve my development experience because it would eliminate the need to poll assembly mass in order to do things such as counteract gravity via VectorForce constraints.


Best workaround

The best workaround I have come up with and have been reluctantly using is to poll AssemblyMass on heartbeat or stepped and compare previous values to detect changes. This is not ideal and I typically dislike doing this especially when physics I do doesn’t already require its own heartbeat or stepped connection at all.

Notable examples of use-case

  • When the character is first spawned, the initial AssemblyMass does not match with later AssemblyMass. Thus reading this on character spawn presents a race condition, and can result in confusing or unintended behaviour or bugs.
  • Parts which are present outside the DataModel do not belong to any assembly. This means that any code which runs on instances which have been :Clone()d will not necessarily act on the correct masses even if an assembly is expected.
  • When an assembly is grounded, its mass is math.huge. This means that if forces are applied before an assembly is ungrounded (e.g. for general purpose modules) unintended behaviour will occur.
  • A side effect of being able to detect when AssemblyMass changes means that it is possible to detect when other important features of an assembly may change, such as the assembly’s center of mass, root part, or otherwise.

The ability to listen to a signal for changes of assembly mass would be genuinely quite useful in a lot of places, and unlike many other physics properties it doesn’t immediately appear to present overhead or compatibility issues.

5 Likes

I’m not too sure, but can’t the use of GetPropertyChangedSignal fix this issue?

From when I tried before, it doesn’t.