Hey Guys’n’Gals,
You may remember me talking about an upcoming new feature (see: http://devforum.roblox.com/t/working-on-a-new-feature-physical-material-properties-looking-for-feedback/18140) where I talked about introducing a new system that is incompatible with how things are currently done in ROBLOX. Originally we were planning on handling this by leaving in a Workspace flag (as you may remember from this post), but the more we thought about it the more we realized that leaving in another Workspace flag that changes internal physical behavior will only hurt the platform in the long run (imagine Toolbox models that magically don’t work because you have a certain Workspace-level flag disabled). In short to deal with this, we will be enabling a temporary workspace flag that allows users to Opt out of the system, but we will eventually be migrating EVERYONE to the new system.
Now, keep in mind that most of your games will be unaffected by this change. When this feature launches, we have a fairly consistent way to migrate custom-set Elasticity and Friction settings into the new mode (and we do so automatically if you flip your Workspace.PhysicalPropertiesMode to New, however in case your game relies on Buoyancy and Density being identical, you may start seeing different behavior.
GameTypes which MAY be affected by this change
- Zero Gravity games may be affected by density change, we encourage
you to use the “GetMass()” function to correctly cancel out gravity! - Physics-Based Submarine and Boat Games may be affected by new
Buoyancy and Density behaviors. - Flight Simulators that use airfoil simulation may find that the
center of mass has moved on objects that have different materials.
ROLL OUT PLAN
Our plan to Roll this feature out revolves around having 3 phases:
-
Phase1: Workspace property introduced.
- Leaving PhysicalPropertiesMode as Default will automatically enable the new PhysicalProperties system during the next stage of
the migration process. - Changing PhysicalPropertiesMode to Legacy will grant users more time in the old PhysicalProperties system, perhaps allowing them
more time to migrate their games to use the system manually. - Users who have set their property to New or Legacy will not see any behavior changes after switching to these modes during the
next section of the Migration.
- Leaving PhysicalPropertiesMode as Default will automatically enable the new PhysicalProperties system during the next stage of
-
Phase 2: By default, PhysicalMaterialsMode is now enabled.
- Places that left PhysicalPropertiesMode as Default will now be automatically migrated to the new system.
- Places that chose to set PhysicalPropertiesMode to Legacy have another month of using the old system.
-
Phase 3: The great migration.
- All places regardless of PhysicalProperetiesMode will begin using the new PhysicalProperties system.
This time-period should give users enough time to figure out if they are affected by this change.
Now to the fun stuff!
Basically, by default parts you create will have Elasticity, Friction, and Density associated with that Material. You can override this default behavior by assigning a CustomPhysicalProperties item to the object, allowing you to customize Density, Friction, Elasticity away from anything pre-set by the part’s Material.
Lua API
- Set custom properties on a part: Part.CustomPhysicalProperties =
PhysicalProperties.new(density, friction, elasticity, frictionWeight
= 1, elasticityWeight = 1) - Disable custom properties on a part: Part.CustomPhysicalProperties =
nil - Read-Only components
- Part.PhysicalProperties.Density
- Part.PhysicalProperties.Friction
- Part.PhysicalProperties.Elasticity
- Part.PhysicalProperties.FrictionWeight
- Part.PhysicalProperties.ElasticityWeight
Interaction
- Friction and Elasticity between two interacting objects is determined
by a pairwise weighted average function. - (Friction_a * FrictionWeight_a + Friction_b * FrictionWeight_b)/
(FrictionWeight_a + FrictionWeight_b)- You can see how if FrictionWeight_a >> FrictionWeight_b, the result ends up coming out as FrictionWeight_a.
- If FrictionWeight_a ~ FrictionWeight_b, the result is right between the two values.
I’ll post here once we have a more concrete timeline. Keep in mind, ,that the length of the Phases are still up in the air, but we are thinking about 1 Month for each phase. As it stands right now, this may start in about 2 weeks. You should be able to test your places on GameTest1 even ahead of the release.
Troubleshooting If Your Game Behaves Unexpectedly
https://devforum.roblox.com/uploads/default/original/2X/6/6f20950b2a9dae3f47ba10837d9679dd43240d5d.png-
Your characters feel like they have too much momentum, and take a while to speed up and slow down:
Check what materials you are using on your floor objects. Are they slippery like Glass or Ice? You may want to modify the frictional properties of these objects to make them more sticky (higher number). -
Your Zero-Gravity parts or missiles propelled by BodyForces, BodyVelocities, or BodyGyro’s behaving incorrectly:
Verify what material they are now, as these objects are likely to have different masses. You may need to re-tune BodyForces. -
Some of your mechanisms have gained a weird vibration and erratic behavior:
Are your mechanisms combining heavy materials with lighter materials? Hinges and Motors joining objects with huge mass differences may have behavioral issues. If you have a metal-chassis car with small plastic wheels you may experience some problems. Try to decrease the density of the car!
IF ALL ELSE FAILS TRY THE FOLLOWING SCRIPTS:
Script 2: Set ALL Densities to 1 (does not include things you load it from assets dynamically)
function recursiveSetAllDensityToOne(instance)
if instance:IsA("BasePart") then
-- See if this is a CUSTOM Physics part already
if instance.CustomPhysicalProperties then
local oldProp = instance.CustomPhysicalProperties
local physicalProp = PhysicalProperties.new(1, oldProp.Friction,
oldProp.Elasticity,
oldProp.FrictionWeight,
oldProp.ElasticityWeight)
instance.CustomPhysicalProperties = physicalProp
else
local oldProp = PhysicalProperties.new(instance.Material)
local physicalProp = PhysicalProperties.new(1, oldProp.Friction,
oldProp.Elasticity,
oldProp.FrictionWeight,
oldProp.ElasticityWeight)
instance.CustomPhysicalProperties = physicalProp
end
end
for i,v in pairs(instance:GetChildren()) do
pcall( function()recursiveSetAllDensityToOne(v) end)
end
end
recursiveSetAllDensityToOne(game)
Script 2: Set any non-Custom parts to OLD defaults.
function recursiveSetDefaultsToDefault(instance)
if instance:IsA("BasePart") then
-- See if this is a CUSTOM Physics part already
if instance.CustomPhysicalProperties then
local oldProp = instance.CustomPhysicalProperties
local physicalProp = PhysicalProperties.new(1, oldProp.Friction,
oldProp.Elasticity,
oldProp.FrictionWeight,
oldProp.ElasticityWeight)
instance.CustomPhysicalProperties = physicalProp
else
local physicalProp = PhysicalProperties.new(1, 0.3,
0.5,
1,
1)
instance.CustomPhysicalProperties = physicalProp
end
end
for i,v in pairs(instance:GetChildren()) do
pcall( function()recursiveSetDefaultsToDefault(v) end)
end
end
recursiveSetDefaultsToDefault(game)
PS: Pardon the spelling/grammar. I have been writing more English today than C++ today, and a sane person can handle that for only so long in a given day. I’m just trying to get this info out to you guys as soon as possible! Post questions here!