Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

What does "BreakJoints()" do other than the obvious?

Asked by
Necrorave 560 Moderation Voter
10 years ago

I am rather curious what BreakJoints() does to the parts involved other than the obvious. Does it change a property, set something to false? Change the sides to "Smooth" surfaces?

Is there more to "BreakJoints()" than what you see? If so, can you please explain?

Thanks :)

3 answers

Log in to vote
5
Answered by
BlueTaslem 18071 Moderation Voter Administrator Community Moderator Super Administrator
10 years ago

All Snaps and Weld and Glue and Hinges &c are parts inside the JointsService.

The JointsService is just the place where all snaps are supposed to go.

When you call BreakJoints on a part or model, the game deletes all of the snaps involving those parts (most of which are in the invisible JointsService, but act just like other Welds or whatever that you've created)


The surfaces of parts themselves don't actually mean much: they only decide how MakeJoints() picks which types of snaps and which parts to snap together.


EDIT:

To find joints on a part is a little difficult. While the canonical place to put JointInstances is the JointsService, lots of scripts that add joints put them elsewhere.

To accommodate that, you would have to recursively scan the Workspace as well. To just find the joints that are made by MakeJoints() (from ROBLOX handling touching surfaces that snap) we just search through the JointsService:

function findJoints(part)
    local j = {};
    for _, joint in pairs(game.JointsService:GetChildren()) do
        if joint:IsA("JointInstance") then
            if joint.Part0 == part or joint.Part1 == part then
                table.insert(j, joint);
            end
        end
    end
    return j;
end
0
How would one create a conditional statement checking to see if a part has joints? (Thanks for the answer by the way) Necrorave 560 — 10y
1
I have added a way to find joints made with `MakeJoints` to this answer BlueTaslem 18071 — 10y
0
Thanks a lot. I really appreciate it. Necrorave 560 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

BreakJoints tells the physics engine to break all the invisible welds in a model, thats about it

Log in to vote
0
Answered by 10 years ago

Other than breaking joints this can also to kill a players character. This is done automatically when the players health is 0. This is why your character breaks apart wen you die

"instance of player".Character:BreakJoints()

Answer this question