Is there any way to adjust the players weight or an objects weight?

So I am trying to make a game that includes rafts and boats and stuff like that and while testing the game I found out when the player jumps onto an unanchored pallet it swings in a circle as if all the weight of the pallet was in the middle. Is there any way I can adjust the weight or center of mass of an object or player?

Thanks, A.P

2 Likes

Erm. Pm me a video of your problem

Hmmm. Want to fix it? Or tell you? It hard to explain.

I would like it if you explained

Want me to fix?
If so shot me a pm

You can adjust the CustomPhysicalProperties in the players legs,torso etc to adjust the weight.

6 Likes

I’m not that advanced in scripting but I will test that out. Thanks

I’m online again are you able to explain how this works to me?

Ill give you a helping hand.

CustomPhysicalProperties allows for the changing of some properties such as the mass or weight. It is mostly easy to follow.

You can set the properties like this: (This is from the API) – Link to API

local density = .3
local friction = .1
local elasticity = 1
local frictionWeight = 1
local elasticityWeight = 1

PhysicalProperties.new(density, friction, elasticity, frictionWeight, elasticityWeight)
part.CustomPhysicalProperties = physProperties

Density = Mass/Volume
Therefore, Mass = Density x Volume

So by reducing the volume or the density, a part’s mass will be decreased. You won’t want to change the volume of players, but as mentioned above, you can change their density using CustomPhysicalProperties

2 Likes

First, you have to know the mass you want each body part to be set to. You can use this, and repeat for each body part.

-- Script in ServerScriptService
game:GetService'Players'.PlayerAdded:Connect(function(plr) -- Player Joins
	plr.CharacterAdded:Connect(function(chr) -- Character Spawns
		task.wait(0.1)
		local TargetDensity = 0.1
		local FRICTION = 0.5
		local ELASTICITY = 1
		local FRICTION_WEIGHT = 0.3
		local ELASTICITY_WEIGHT = 1
		local BP = chr.LowerTorso -- Change this to the right body part (You could do this for all body parts individually if you'd like)
		local DesiredMass = 6.176 -- Change this to the final mass you want the part to be
		BP.Massless = false
		BP.CustomPhysicalProperties = PhysicalProperties.new(TargetDensity, FRICTION, ELASTICITY, FRICTION_WEIGHT, ELASTICITY_WEIGHT)
		local Volume = BP.Mass / BP.CustomPhysicalProperties.Density
		local OTargetDensity = Volume*(DesiredMass)
		local Modifier =  DesiredMass/(Volume*OTargetDensity) -- This will adjust the offput of the mass to make it the DesiredMass
		local TargetDensity = Volume*(DesiredMass * Modifier)
		local physProperties = PhysicalProperties.new(TargetDensity, FRICTION, ELASTICITY, FRICTION_WEIGHT, ELASTICITY_WEIGHT)
		BP.CustomPhysicalProperties = physProperties
		print(BP.Name.. " Has a Mass of: ".. BP.Mass) -- Prints the body part name and the body part mass
	end)
end)
2 Likes