What I need:
Find the set of all parts that have been welded together, starting from any part P in that weld configuration.
Bruteforce solution:
- Iterate over the entire
workspacehierarchy and find the setWof all WeldConstraint, Weld and ManualWeld objects that referenceP - Do a DFS (probably easier to implement efficiently than BFS or other graph exploration methods) from all
winW(this is a graph where welds are edges and parts are nodes) to define the complete connected subgraph of parts - Return that set of nodes
The problem:
The above method is highly inefficient, and it would require me to do a workspace-wide bookkeeping effort to handle efficiently. However, since the physics engine already needs an efficient representation of that connectivity graph, I would assume that the physics engine should expose an API to tap into that. However, I haven't found that API? Is anyone aware of such API?
Motivation:
There is several use cases that I will need this for in the near future, most urgently:
Scripts that are supposed to work on "dynamic" (i.e. unanchored) parts Q must, generally speaking, make sure that any Q is not welded (directly or indirectly) to an anchored part, or else, it might generate some very strange physical behavior because it tries to treat a part that is welded to an anchored part as freely moving about.

2 comments
Try looking at tags, https://www.robloxdev.com/api-reference/class/CollectionService
@SinisterMemories Keeping (1) weld configuration and (2) tags in sync would be a tax paid by the designer. I'd rather solve this more holistically using a method that can assure that I would not accidentally overlook any parts in the weld configuration.