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