What do you want to achieve? Keep it simple and clear!
I want to make a bridge that breaks at the joints in which it has too much force. So, there will be a lot of parts connected by welds to each other, each weld being places where it can break. I want to have a server-side script that updates the amount of stress on any given joint and breaks (destroys) it if the stress is too much.
What is the issue? Include screenshots / videos if possible!
I’m not sure of a way to fetch the current amount of stress on a weld at any given time. The way I’m doing it right now is: (with c being the weld constraint)
c.Part0.Mass * (c.Part0.Velocity.Magnitude^2)
However, that only works if the part0 is moving. Also, I don’t even know if that’s accurate at all, I just saw it somewhere.
What solutions have you tried so far? Did you look for solutions on the Creator Hub?
I looked through some other posts about adding a feature to get the stress on a weld, but they were just requesting that a feature be added.
I am doing a science project where you have to make a toothpick bridge, and I want to test different designs, but it takes too long in real life, so I want to do it here. This is how I want to go about this:
--this script (not local) is the child of a Part with a WeldConstraint attaching it to another part
local maxStress = 100 --idk test variable
local constraints = {}
--add all weldconstraints to the constraints table
for _, v in pairs(script.Parent:GetChildren()) do
if v:IsA("WeldConstraint") then
table.insert(constraints, v)
end
end
function update()
for _, c in pairs(constraints) do
if c.stress >= maxStress
c:Destroy()
end
end
end
while (true)
wait(0.1)
update()
end
So, how would I get the stress on a weld that isn’t moving?
Okay, this is a weird idea I had, but it could work.
Maybe, instead of using welds, you use align position to hold the bridge together. But each align position is relative to the part it comes from. Then you can adjust the strength of the align positions for the strength of the welds. Also, if a part gets to far away from where it’s supposed to be aligned to, you can destroy the align position, like you would destroy a weld under to much stress.
I know this is a sort of “wild” idea, but I think the only other way would be to recreate roblox’s physics engine, which would be hard.
You could also pair this with align orientation, so stuff doesn’t spin out of control. Along with that, maybe you could use a ball socket constraint with align orientation, or some other pair, to make the movement under stress more realistic.
If you find another way, you should probably go with that, since this is a bit of a weird way, but if you can’t find another way, maybe give this a try.
I hope this helps in some way to solve your problem!
So with your model, if I were to put the parts under a lot of weight, the align position would be kind of elastic and eventually break? Like, the align position isn’t welded in place and immovable, and it can break under some (small) amount of force? This seems very useful.
Yes, it would sort of be like attaching everything with rubber bands, and once the rubber bands stretch to long, they would break.
Also, the align position is constantly relative to the part it’s branching off from, so it moves with it’s that part.
This would be a better way to align them, compared to how I said in the first post.
Another idea for an improvement I had would be to maybe also make the align positions mutual (so with a pair of parts, both parts are aligning eachother), so when one part moves, it pulls on the other.
That seems like it should work well! However, I don’t really have the time to test it since I am super busy with school and sports right now. I will try the moment I’m free!