Hello! I am currently making a battle Royale game and have this issue for a while now, I am trying to get builds to collapse (fortnite style) when there’s nothing connecting them to the ground, so far all of the things I have tried have resulted in either the builds being in the air floating or the builds collapsing whenever you break a build next to them regardless of weather it is on the ground or not.
I would just like to know if there’s an easier way to do this that I could be using.
To clarify: I would like some help creating a system where builds that aren’t connected to the ground directly or via other builds that are also connected to the ground collapse
Set up a certain region under the building. This can be done using a part that serves as a bounding box of sorts or through point coordinates that eventually construct a Region3 box below the building.
Use Workspace.IsRegion3Empty to check if there are parts in that region. If there aren’t, the building is floating - perform your collapse logic in this case. This would probably equate to unanchoring an anchored building or whatever logic you have prepared for collapsible buildings.
I’m asking if we can get if there is something connecting it to the ground, this could mean walls above the floor connecting to a ramp that eventually gets to the floor somehow, simply getting the region below the build won’t cut it
I don’t play Fortnite nor am I knowledgeable on anything about it. Saying “Fortnite style” isn’t sufficient enough information to back this thread, you can’t expect that everyone knows what you’re talking about. An example of the situation you’re trying to get would be greatly appreciated.
As far as I know, without constructing a region or using a method to detect for parts touching the ground (specifically under the BasePart class), you’ll have a difficult time trying to figure out a solution here or perhaps its not achievable on the platform itself in the specific style you seek.
perhaps its not achievable on the platform itself in the specific style you seek
1: Strucid has this building system
2: Island Royale has this building system
I have made some complicated methods that involve using region3 on all of the spaces around the build to detect if the ones around them are connected to the ground in any way, then telling the builds that it detects around it to do the same to virtually “update” them much like a minecraft blockstate updates, I am just unable to get it correct at the moment, and am hoping for some advice on the topic.
Again, I don’t play either Strucid or Island Royale. You can’t expect anyone to actually know off the fly what you’re talking about, which is why I asked for examples to be provided. By examples, I mean specifically Gifs, images or videos. That may have not been clear beforehand.
Also keep in mind in the original post i said “when there’s nothing connecting them to the ground”, I assumed people wouldn’t think i meant “when the build isn’t connected to the ground” as I thought that wording it in this way would just work in conveying the point that i need them to be connected directly or indirectly to the ground, I apologize for the misunderstanding
This is a lack of clarification on your behalf because you are still not providing examples, such as images or any other media content that would help give a general sense of what you’re trying to accomplish. Including details helps get rid of misconceptions and better understand the problem.
Region3 is still capable of detecting if nothing is connecting them to the ground, it just doesn’t cover the scope of non-connectedness that you are supposedly looking for.
when the bottom builds are broken the rest collapse
When the build is on the ground then the build will not collapse
when a build is connected to another build that is diriecly connected to the ground or chained to one that is connected to the ground, the build should stay
When the build is not connected to the ground diriectly or indiriectly it should break
If hitting something that isn’t connected to the building causes other parts of it to unessecarily collapse, your weld script isn’t working properly. That is, if you have one at all. What is the method you’re using to hold the buildings in place?
They are all anchored, i have objectvalues inside of the builds that contain which builds they are connected to, when a build breaks it updates the builds around them to check if the value inside of their objectvalues has been set to nil, or the parent set to nil, if it has it does the same for that build, collapsing it and updating the ones around it
Hmm… that might not be the greatest sytem. You could try raycasting downwards from a building’s primary part when the object value updates and seeing if there’s anything beneath the build. If not, unanchor it.
Well, the thing is that the builds can also connect to builds next to them as well, so if i were to do that, then i would also have to raycast for the available spaces around the build, but i’ve tried that and because of the nature of it if there are two builds next to each other in the air they will find each other instead of collapsing
That’s why your system isn’t great. Instead of anchoring the buildings, you should weld them together. Then, you can get your desired behavior automatically.
I would do that but the builds are meant to float and then individually collapse and be destroyed that way the user has a chance to reconnect the builds before they’re all destroyed
Still weld everything. After a building is deleted, loop through everything and anchor it. After a second, unanchor it all. Unsupported buildings should fall and, assuming you do the welding as you place new ones, the others should be fine.
build phase
– 1st needs to be on ground or other permanent
– then others can be built on top
– new root can be introduced ← main problem causer
destruction phase:
– piece breaks
– all dependent pieces queue for destruction
– then their dependents queue
track distance from grounding by links?
ground link is 0
each time a link is added +1 to lowest attached piece
if new ground added you recursively check distance from new point using the lower of the two values (stored and new)
after piece breaks you check attached pieces for root (root connection can be higher up don’t use numbers for this)
if no root destroy, then you can destroy pieces based on proximity to ground by linkage
not just height
you unanchor them in numerical order
will need to keep a table of children scheduled for death
{
[3] = {}
[4] = {}
}
how inefficient this is? no clue, but you want pieces to fall down under specific conditions in a specific order
This is how I do it in Strucid. It’s pretty simple. You just use a recursive loop to go through each connected build and return true as soon as you loop to a part that’s touching the ground. If true is not returned, that means the building is not connected to the ground.