I am working on a game that uses building tools similar to those of classic Roblox. One element of this is a drag tool which positions a part and creates welds with every surface that it is touching. Earlier, it called MakeJoints
in order to create these welds, but it has some limitations that make it hard to work with. It would be preferable to use the new constraint types instead of the deprecated Weld
instance, and there are situations where I’d like to examine connected parts without creating welds. To do this with MakeJoints
means calling it, iterating through every created weld, and then deleting them all, which is just silly and causes bad performance issues when it’s done with many parts at once.
There are several topics here about MakeJoints alternatives, but they mostly recommend spatial query tools like GetPartsInPart
or GetPartBoundsInBox
. Making a resized clone of the part to call GetPartsInPart
on would result in a lot of instance creation spam and cause parts that aren’t actually touching (i.e. at a corner) to weld. GetPartBoundsInBox
wouldn’t work on surfaces like the triagonal side of a Wedge and would have similar tolerance issues since it’s doing collision detection with a box, not a plane. I have tried looking into the math behind the actual MakeJoints
method but porting that to Lua is beyond me.
Basically, I’d like a way to get connected parts by surface attachment in a way as similar as possible to the actual MakeJoints
function. I have a feeling I’m missing something here, since this seems like the kind of utility someone would have already made a library for. Some plugins (including Roblox ones like the Lua dragger) also do similar spatial queries, so it’s possible that I could find the code for it there. I would appeciate any feedback.