Set Material PhysicalProperties

Currently, Materials have an associated set of PhysicalProperties PhysicalProperties Matieral Constructor - I’d like the adjust the physical properties associated with each material so that I do not have to manually change the custom physical properties of parts based on their material (ideally, so that simply selecting the property, it has my adjusted set of physical properties on the part based on material).

One option could be for me to just do :

local PropertiesMap = {
	[Enum.Material.Plastic] = PhysicalProperties.new(
		1,  -- Density
		0,  -- Friction
		.5, -- Elasticity
		1, --FrictionWeight
		1 -- ElasticityWeight
	),
	[Enum.Material.Metal] = PhysicalProperties.new(
		1,  -- Density
		0,  -- Friction
		.5, -- Elasticity
		1, --FrictionWeight
		1 -- ElasticityWeight
	),
}

local part = Instance.new("Part")
part.Material = Enum.Material.Plastic

part.CustomPhysicalProperties = PropertiesMap[part.Material]

However, I’m wondering if there is a way for me to directly change what physical properties are associated with each material. I checked MaterialService API and did not find such options

Thanks for reading !

3 Likes

Unfortunalty changing things based on material is not a base part of roblox or studio and the best and only way is by using a script. Material and things like that are for appearances so dont actually have an effect, if they were to be made with different values it would make building a lot more complicated than it needs to be for everything that doesnt require realistic properties.

Wrong. Materials do have actual affect on physics.

2 Likes

Can you provide a source please? Never heard of it.

Here is a link to the materials and their respective physical properties that will affect the physics of anything interacting with it that has phyiscal properties itself:

3 Likes

True some do have changes to friction but other than that other properties arent a big deal. Still you need a script if you want actual physics to work properly

i don’t think its possible to change the default PhysicalProperties

but here is how you can do it with a script

local PropertiesMap = {
	[Enum.Material.Plastic] = PhysicalProperties.new(
		1,     -- Density
		0,     -- Friction
		0.5,   -- Elasticity
		1,     -- FrictionWeight
		1,     -- ElasticityWeight
	),
	[Enum.Material.Metal] = PhysicalProperties.new(
		1,     -- Density
		0,     -- Friction
		0.5,   -- Elasticity
		1,     -- FrictionWeight
		1,     -- ElasticityWeight
	),
}

local function SetPhysical(decendent)
    if decendent:IsA("BasePart") == false then return end
    if PropertiesMap[decendent.Material] == nil then return end
    decendent.CustomPhysicalProperties = PropertiesMap[decendent.Material]
end

for i, decendent in ipairs(workspace:GetDescendants()) do SetPhysical(decendent) end
workspace.DescendantAdded:Connect(SetPhysical)
3 Likes

Nice ! This’ll make a nice wrap for MaterialsService :slight_smile: