ApplyImpulse - an object with different masses travels the same distance

How to make an object with different masses fly the same distance. I did this, but the smaller the mass, the weaker the object flies. I made some ratio here

function GetModelMass(model)
	local mass = 0
	for _,v in model:GetDescendants() do
		if v:IsA("BasePart") then
			mass += v.AssemblyMass
		end
	end
	return mass
end

local koef = 8.3
local modelMass = GetModelMass(fireTypeClone)		
Part:ApplyImpulse(direction*koef*modelMass)

Could you just set the velocity directly? That seems like it would solve that problem

AssemblyMass is a refernce to the mass of the entire Assembly. In mose cases models are one Assembly meaning you can just use that value.
This

function GetModelMass(model)
	local BasePart = model:FindFirstChildWhichIsA("BasePart")
    return BasePart and BasePart.AssemblyMass or 0
end

is the same as

function GetModelMass(model)
	local mass = 0
	for _,v in model:GetDescendants() do
		if v:IsA("BasePart") then
			mass += v.Mass
		end
	end
	return mass
end

1 Like