Improved Mass Properties: Decoupling Collision Geometry and Mass Properties [Beta]


Hi Creators,

Today, we are excited to announce an upcoming change to how we calculate mass, center of mass, and moments of inertia for meshes in Roblox. Currently, these mass properties are calculated based on the volume produced by the mesh’s collision geometry (dictated by Collision Fidelity). Moving forward, we will rely solely on the asset mesh’s volume to calculate mass properties, ensuring that changes in Collision Fidelity do not affect a mesh’s mass properties. This will be a much more stable source to calculate these properties from and will set the stage for future improvements to Physics and Geometry on the platform.

To avoid unexpected changes in experiences, we are releasing this as an optional beta feature before enabling it for all experiences.

Why Are We Doing This?

By making this change, the mass properties of a mesh will no longer depend on the mesh’s Collision Fidelity. This decoupling of collision geometry and mass properties allows users to change the Collision Fidelity of a mesh without any changes to its physical behavior from a mass property perspective (the collision geometry will still change therefore changing how the mesh collides with other objects). This should make it easier for creators to build with physics in a more intuitive manner.

What Specifically is Changing?

When enabled, this change will affect all new MeshParts and CSG operation results. This change will not affect:

  • Meshes already serialized in published experiences
  • Meshes imported locally before this change goes live
  • Meshes published to the Toolbox

Meshes in the above categories will have their mass properties temporarily frozen at their last calculated values. They can be migrated at any time by changing their Collision Fidelities at least once. We have also provided a script that will automatically migrate any selected MeshParts or CSG operation results to this new behavior. To run this script in Studio, select the parts you wish to migrate, go to Model > Run Script in the Ribbon and select this script.

Click here to view script
-- Update Mass Properties of all MeshParts and PartOperations in selection
local Selection = game:GetService("Selection")
local parts = 0

-- Iterate Selection
for _, object in pairs(Selection:Get()) do
   if object:IsA("MeshPart") or object:IsA("PartOperation") then
      local cf, mass = object.CollisionFidelity, object.Mass
      -- Flicker CF: change to something it's not and change back to
      -- get new mass props.
      if cf == Enum.CollisionFidelity.Box then
         object.CollisionFidelity = "Default"
      else
         object.CollisionFidelity = "Box"
      end
      object.CollisionFidelity = cf

      -- If mass doesn't change, don't include in final update count
      if mass ~= object.Mass then
         parts += 1
      end
   end
end

if parts > 0 then
   print("Updated the Mass Properties of " .. parts .." Parts!")
else
   print("No Parts were updated.")
end

How It Works: Opting In and Opting Out

To opt into this beta feature, go to File > Beta Features and enable Improved Mass Properties.

When Opted-Out (Existing Behavior):

  • Existing and New Meshes: All meshes will continue to have their mass properties based on the collision geometry’s volume. This means that when you change the collision fidelity of any existing mesh or set the collision fidelity for new meshes, the mass properties will be determined by the volume of the collision geometry.

When Opted-In to the Beta:

  • Existing Meshes: The mass properties are temporarily frozen. They won’t change until you either change the collision fidelity or run the migration script. Once you do this, the mass properties will be recalculated based on the source mesh’s volume.
  • New Meshes: Mass properties are calculated from the source mesh’s volume right from the start. They will no longer depend on the collision geometry’s volume.

If You Opt-Out After Opting In:

  • Existing Meshes: Again, the mass properties are temporarily frozen. They won’t change until you either change the collision fidelity or run the migration script. If you run the migration script, it will recalculate the mass properties based on the current collision fidelity. If you change the collision fidelity, it will recalculate the mass properties based on the new collision fidelity.
  • New Meshes: The mass properties will be calculated based on the collision fidelity’s (collision geometry) volume from the beginning.

Remember:

  • You can switch (opt in and out) as many times as you want. The above behavior will always apply.

Why Should You Care?

If your experience relies on the mass properties given by a specific Collision Fidelity, this change can produce different physical results for new meshes you upload. While on average these new mass properties are close to the values currently given, they can produce different results for users who use Box Collision Fidelity on their meshes.

We hope that by releasing this first as a beta for a few months, you’ll have time to experiment with the differences in mass properties and adjust new meshes accordingly to their use case.

Potential Breaking Changes

The only experiences that may experience a breaking change are those where new meshes are constructed in-experience via CreateMeshPartAsync or a CSG operation and these meshes’ mass properties are used for physics gameplay in a highly-tuned, sensitive manner.

We recommend that developers who call CreateMeshPartAsync or perform CSG operations in-experience with GeometryService double-check that the resulting parts still behave as expected with this beta enabled.

Note: These potential breaking changes are only possible when an experience is opted into the Beta feature. This will eventually affect all experiences once we transition to full rollout, so please test it out.

What’s Next?

We plan on keeping this change under an optional Beta feature until October 13th, 2024 (for 10 weeks) to allow for developer feedback and necessary bug fixes. On Monday, October 14th, 2024, we will transition to a full rollout. If you think this change may affect your experience, please watch this post to stay up-to-date on any changes or updates (click on the bell icon on the right side and select “Watching”).

As always, we appreciate your continued support and feedback. Stay tuned for more updates in the coming months!

Best,
M0bsterLobster

123 Likes

This topic was automatically opened after 10 minutes.

Exciting stuff! How does this handle non-manifold assets or other assets with zero or undefined volume?

32 Likes

I love how Roblox is creating more beta features and letting us test them.

22 Likes

Physics changes demonstration?

16 Likes

It should largely work (and look) the same.

From what I understand they’re using a pre-calculated volume value for the mesh instead of calculating the volume of the collision geometry when determining the mass.

The volume value should be about the same as before, but will be constant for the same mesh.

15 Likes

Will this change have any effect on performance? I’m really not sure but from what i can gather handling 100% geometry accurate physics may be more intensive, no? Would this change also potentially increase memory usage?

10 Likes

Hello! This change attempts to account for non-manifold-ness by calculating volume from a “stable” (non-infinite) point of reference, as well doing things like detecting if a mesh is sufficiently flat. Ultimately, we can do only do so much with poorly constructed meshes, since it isn’t always clear what 3D shape it represents, so we highly recommend using manifold, 3D meshes.

17 Likes

Requesting clarification if this will apply to pre-existing meshes after the beta or will those meshes keep the same behavior (won’t change until migrated).

Slightly off-topic, but are there any plans on also decoupling CanQuery from CanCollide?

11 Likes

Why do we have no ability to set mass/inertia tensor directly and override these calculated values? Unreal Engine offers this with their “Set Mass Override in Kg” property. Why do we either have to resize the object or play around with density to simply change the mass? I mentioned this back in 2022

17 Likes

When collision is on the quick lookup and data tables that CanQuery provides is required for physics engine to work

9 Likes

Good that we can experiment with it and opt-in and out before it gets realeased.

6 Likes

you can with checkbox something like custom physical properties, I use it to make some stuff frictionless

4 Likes

Hi! So the change adds little overhead to the performance of generating physics data for a mesh (worst case - 0.3 ms). In most cases, creating accurate physics is actually less performance intensive, since most of the time a Collision Mesh has many many more triangles than the source mesh.

Also, this change actually allows us to decrease memory overhead per mesh long-term.

6 Likes

Great question! Even after the beta, old MeshParts and CSG operations will keep the same behavior (won’t change until migrated).

4 Likes

Unfortunately that doesn’t offer the best control when it comes to giving an object an exact mass.

4 Likes

This change breaks the ability to have character rigs hover in the same place in Terrain water. Before, setting the Density property to 1 allowed all BasePart’s to stay in the same place in Terrain water (no sinking or floating). However with this change, the Mass and the collision mesh volume show a clear discrepancy, resulting in Density of 1 not actually being the Density of 1 anymore for MeshParts. A read-only property or a method for retrieving the Volume of the collision mesh for MeshPart’s would solve all of this, so we can adjust the density by knowing the volume and mass values. Either that or Density should be adjusted to work in line with this new change.

5 Likes

CAN an object FINALLY not be affected by gravity? This would be kinda useful. But thank you for the update :open_hands:

1 Like

Hi there.

This change has broken collisions with non-watertight (non manifold) inverted hull meshes.
Here’s an example:
rbxassetid://18976214236
* I am able to provide more mesh ids if requested.

As a note; I have these all on box collision as these are character meshes and don’t need highly precise collision as I have them as CanCollide off anyways.



* Just as a note, the pivot of this part doesn’t change this behavior.

Whenever I remove the mesh id of the mesh part and then I duplicate it, the assembly mass skyrockets and it flies off to nowhere.
image

Thank you for your work; I will switch off the beta for now in order to disable these changed collisions.
But as an extra note, this inverted hull trick allows me to get stellar R15 avatars with stylized looks, and is quite common as a modeling technique.
image