I have a tool made of many parts, of course they cant be anchored so if I make it a model I would have to individually weld each part together. A union would solve this but I’ve heard unions are really bad for performance. Any work arounds?
What about WeldConstraint?
unions are only bad for collision, so it wont be bad if you only have a few or if you turn the collision off
the best option though is to use a script to create weldconstraints for you
this example has a tool with a Handle and then a model named model with all the other stuff inside of it (unanchored)
local rootPart = tool.Handle
for _, part in ipairs(tool.model:GetDescendants()) do
if (part:IsA("BasePart") == false) then continue end
local weld = Instance.new("WeldConstraint", rootPart)
weld.Part0 = rootPart
weld.Part1 = part
end
I thought parts had to be touching for weld constraints to work haha, i’ve been using them only for tools with little parts but if that’s not the case then this is definitely the best method thank you
Unions are bad when your entire game is unions.
This is because the game has to calculate collision and bounding boxes.
- If you have a reasonable amount (you could probably have hundreds and be fine) you won’t see major issues.
So if I turn off can collide and can query for these unions, will it not do that calculation or will they still make a hitbox?
I would make one part (the handle), make it invisible and cancollide false, and weld every other decorative part to the handle. Make sure the extra parts have cancollide disabled and are unanchored.
If you’re afraid it will take a long time to weld every part individually to the handle, you can simply write a script to do it, like how @happya_x did. There are many plugins that do the same as well!