if you want to make it working when you place wall cal function rec with wall as parametr and if you want to make 1 wall as wall of 2 rooms (room1|room2) you must set parent of clone (wall:Clone().Parent at place of wall.Parent)
Ok I will try to fix it tomorrow I am +1 and it is late
ok i thinked about this and i have solution, but first lets find the bad line:
for v, wall in pairs(WALLS) do
rec(wall)
end
this will do regroup for every wall so i regroup the left wall first and it will auto regroup the middle one and the right and than the problematic line will call regroup of the middle one, that have grouped wall on both sides so you must add your place mechanism to it and remove the walls and it can work than
Hmm…
Ok…welll i think i started undestanding but idk
Because post limit, i needed to solve it by private messaging with @Imaginze and here is game i made that will detect rooms
Expanding on the pathfinding idea:
Just detect positions betweens nodes, and try to see if pathfinding can get out of it. If it can’t, it’s closed. If so, it’s open.
I think that’s what people are trying to get to, not sure tho
That’s a brilliant and creative solution! It’s also exactly how a really basic maze solving algorithm works too. Follow one edge and eventually you’ll end up at the exit where there are no more edges. If you reach the first edge it must be a closed loop, meaning a room!
In fact, I wonder if all solutions to this problem are maze solving algorithms, and vice versa?
My solution is regrouping the walls to models and when I place wall and there are 2 walls from same model touching it, it must be connected on other side so it must be room
I already made this by regrouping walls to model
A post was merged out for bumping.