BasePart:GetJoints() might be useful

We have :GetConnectedParts() but I would need to also get the welds such that I can break some of them.

Eg to break any welds connected to the ground for example.

I know this can be done by going through all them welds in jointsservice but that seems inefficient.

10 Likes

This would be very useful, specifically because not all of a part’s joints are in JointsService, and you’d have to browse through every descendant in Workspace and JointsService to truly locate all joints connecting any given arbitrary part to another.

2 Likes

Make sure to check the date of the post before replying :wink:

i.e. this thread didn’t seem to raise much interest so it’s probably best to either refine the idea some more, think of some more use cases, and make your own thread about it.

To be fair, this thread was posted before the switch to Discourse, so feasibly it could have gotten a ton of thanks that weren’t carried over. Usually topics that are liked a lot get responses, but I’ve seen quite a few where I guess the OP worded the suggestion perfectly and nobody replied.

1 Like

This has always felt like a big hole in the API to me.

There is a workaround, but as GigsD4X noted, it’s easy to write something that fails in a few cases, and doing it correctly is convoluted and inefficient.

Necrobumping is better than duplicate threads IMO.

3 Likes

*out of nowhere gets random email notifications from necroed suggestion*

Regardless of whether this is or is not popular, it is a very specific feature that many people wont need. But the few people that DO need it, will find it very useful (when scripting some complex systems).

For example, I wanted this for things like:
-Simulating fire spreading
-Simulating pipes / electricity (which must detect what other parts the lines are connected to)
-Simulating structural integrity and other such things

Those are exactly the kind of things that roblox was visioned with IIRC, yet without a feature like this, its very awkward to create such systems.

TL;DR: many people wont be using this, but the few that do, can create some very interesting and reusable systems with it (electricity/pipes/structural integrity/fire and so on could be easy to integrate in a game thru a free model).

Yup, basically anything that has to do with doing complex work with unanchored parts connected with joints. For example, a few features of Building Tools by F3X depend on finding all the joints of parts in order to preserve them, but it’s impossible to find all of them without searching through all of JointsService and Workspace—it’s extremely inconvenient and 100% impractical. I’m sure ROBLOX probably keeps this information available in their internal API, it’d just be great if they could expose it to us via a method.

1 Like

This has become more relevant with the new joints system. I’d like to see which Constraints are using a given Attachment without looping through every Constraint.

array<Constraint> Attachment:GetConstraints()
event Attachment.ConstraintAdded(Constraint)
event Attachment.ConstraintRemoving(Constraint)

maybe?

1 Like

This recently became an actual performance issue for me, when I added a whole bunch of welded structures to my place (resulting in 18k joints total).

I have a function I use regularly, findModelExternalJoints(model), which finds all joints that connect parts of the model, to parts outside the model.

It used to just iterate over everything in JointsService (now 18k joints). I had an operation where its called twice, and each call took 0.2 seconds. Very simple, so I couldnt micro-optimize it beyond 0.1 secs.

Clearly thats unacceptable.

To fix this, I had to make some code that maintains a part=>joints map (for EVERY part in the entire place), for quick lookups (listening to every addition/removal of a joint, and changes to each joints properties).

Now, that works, but maintaining such a lookup table for 18k joints and almost as many parts, and handling all the events, probably has some overhead. But at least the overhead doesnt manifest as lag spikes.

So script a system like that if you find the lack of this feature problematic (and make sure to handle joints that arent in jointsservice, somehow, if necessary. I didnt need that fortunately.).

2 Likes

Necrobumping to keep the discussion here centralized.

Just ran into this problem again. I’m making a building plugin, and I’d like it to change the C0/C1/Position/etc of any attached constraints/joints when the user moves a part around.

What that means is that I need lists of which joints/constraints are constraining which parts. The only way to make such a list is to traverse the entire game tree and listen for changes in Part0, Part1, and Parent on each joint. That’s impractical to do for large, dynamic levels with many joints.

This feature would be particularly useful in situations where you don’t know the joint structure of a model in advance (e.g. plugins), or if you simply don’t want make hardcoded assumptions about your own joint structure.


tl;dr: Asking for a way to get a list of Constraints that are using a given Attachment, and a list of JointInstances that are attached to a given BasePart.

3 Likes