Getting mass of a part with welds

image

In my game, I’m making a system which allows the player to pick up objects and drag them around by holding left click on the object. When doing this, I need to get the part’s mass so I can compensate for the part’s gravity.

This works perfectly fine until I weld 2 parts together, since the script is only getting the mass of the part which I’m clicking (not getting the mass of both parts combined)

Is there a way I can get a list of all parts welded to the part that the player is moving or is there another way to fix this problem?

1 Like

Current script if it helps or if you want to edit it:

local GoalPosition = (char:WaitForChild("HumanoidRootPart").Position + Vector3.new(0, 1.5, 0)) + cam.CFrame.LookVector * 6
-- If you don't understand this, it just moves the part 6 studs in front of the camera

local ObjectMass = TargetObject:GetMass()
SelectionCursor.Velocity = ((GoalPosition - SelectionCursor.Position) + Vector3.new(0, ObjectMass, 0)) * 5

Best to just keep track of objects that are welded together when you create the welds. Something that could be handled through a data table.

Or is it possible to just make objects massless for movement purposes?

BasePart.AssemblyMass?

2 Likes

So there’s not really an easy way to do this? I figured it would be a lot easier if I didn’t have to manually write a script every time I weld a part together since it would make adding new things to the game a lot more difficult

I could make the part massless, but I would also need to make the welded parts massless too which I can’t really do if I can’t get a list of welded parts

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.