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.

9 Likes

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

From when I tried before, it doesn’t.

1 Like

This would be extremely useful for me right now, and I’m surprised GetPropertyChangedSignal doesn’t fire for this property already. I’m trying to write a script to allow for gravity in different zones that tracks and accounts for changes of mass in both props and player characters alike. As a character’s mass isn’t initially correct when they spawn in, and body parts or accessories can take variable lengths of time to load, I figured using GetPropertyChangedSignal with an update function would be a good call.

I’ve been pulling my hair out for the past 3 days trying to figure out why player characters - and only player characters - were still experiencing a net 0.07 g force, and it’s because GetPropertyChangedSignal silently fails(?) here. Please consider changing this.

Edit: I’d also like to tack this thread on. AssemblyRootPart changes also don’t fire this event.

2 Likes