-
What do you want to achieve? Keep it simple and clear!
What I’m trying to achieve is a stability system for my rust building system where if lets say you destroy the foundation then everything above it gets destroyed and if you destroy a wall and there’s a roof above it then only the wall gets destroyed nothing else because the roof can hold it up. So basically this : https://www.youtube.com/watch?v=FrYwXCN_TRI&t=231s at 3:20. -
What is the issue? Include screenshots / videos if possible!
I made my own stability system but it doesn’t work 100%. Let’s say if a wall gets destroyed, it raycasts above the wall and looks for other walls above it and then destroys it. It works well but there’s some problems like if you destroy a wall halfway up then everything above it gets destroyed even though there is a roof there and many other problems which I can’t list here. I do have my own scripts but there are so many of them that I couldn’t put them on here. I also have no idea how the dude in the video got it to show the stability percentage. And also my rust building system uses attachments and the attachments have object values in them named “AttachmentAttachedTo” and the value of those get set to the attachment they have been attached to. So there must be a way to make like a table of all the connections of roofs, walls, stairs, etc. But I have no idea how to make that because it seems very complex for me. This is the last thing I need before my rust building system is complete and I can launch it on my yt channel. I am NOT asking for scripts I just need someone to head me in the right direction and then I can code it myself, it’s just the connections thing. I’m thinking of like a skill tree system with all the connections but idk how that would be saved in a table. -
What solutions have you tried so far? Did you look for solutions on the Developer Hub? I have tried raycasting that’s it and looked for solutions on devforum and YouTube.
How does your building system work? Can items only be placed on a 3D grid? That would make the situation easiest. Otherwise you need a more complex way to decide whether two things are connected. For calculating stability, you can make rules for the max weight or torque that each connection can hold and destroy that piece if it is exceeded, like a bridge builder game.
Here’s my solution;
Whenever, say, a wall is built on a floor, a WeldConstraint is created (or maybe an ObjectValue with a tag or something), Part0 being the floor and Part1 being the wall. The WeldConstraint MUST be parented to the floor for this to work. A destroyed event connection to the floor checks for WeldConstraints inside the floor. Gets the Part1 of those constraints, and check if it is connected to anything as Part1 with GetConnectedParts(), and if it isn’t, destroy it.
Keep in mind I haven’t really tried this, I only thought about it on the spot. It still sounds its pretty good to me though.
My building system is a free build only for the foundation, the walls and everything else snaps to it.
I mentioned each attachment has an object value in it named “AttachmentAttachedTo” and the value of it is the attachment it is connected to