Hello, guys. I’m making vehicle building system. So, vehicles can be built within pad boundaries, and after, you can spawn it. But, vehicle should just break on spawn - so I need WELD parts together. Nearby parts, because there’s also motors, servos…
And after some scripting, I realized that I have 2 ways to weld parts:
Weld every overlapping/touching part with other part. Even if that part already welded to current part with weld’s “chain”. Faster than 2 way.
Weld every overlapping/touching part if there’s no weld “chains” to it. Slower, because I need check for every existing chain.
But, to decide what way I need use, I need know, will be there any PHYSICAL and PERFORMANCE diffirences for such weldings:
Way 1:
Way 2:
(Images above are visualise part’s welds if every part here are overlap)
If you’re making use of WeldConstraints, allow me to introduce “Way 3” to you, choose one part to be your main part, like the chassis of your vehicle for instance, and whatever needs to be welded to that chassis, just create a WeldConstraint from the chassis part to that part you want to weld to it. Parts don’t need to touch to be welded together, and WeldConstraints won’t move the parts into the same position.
My system REQUIRES that 2 parts should touch eachother, because PLAYER can build his car, and if I’ll just weld smth by random, I’ll end up with wheels welded to chassis, and this will result in not working car.
In that case, why don’t you just make it so that (I assume that placing parts will happen with the mouse and clicking) when you click on a part to place a part on it, it automatically welds the part to the part you’ve clicked on.
Also, for the wheels, if you’d make a system that only welds the WeldPart (for instance) in the model of the wheel to the chassis, with the wheel being hinged onto that WeldPart, the wheels will work.
In my opinion having more welds will result in more instances, which ultimately results in insane lag.
Let’s say you have a car with 9000 parts (just an example), and you add another part to it. The script will then literally create another 9000 welds.
Bare in mind though, even though option 2 is still better, in the same 9000 parts example, the script will go over 9000 parts and check for their children, so both options are definitely not optimal.