u put the normal glass, when it is touched the broken glass to teleport where the normal glass is (the broken glass needs to have joins) then when the broken glass is teleported break its joins
Wikipedia says “Fortune’s algorithm is a sweep line algorithm for generating a Voronoi diagram”
I think a Voronoi diagram simulates breaking glass. Again, Wikipedia says “In mathematics, a Voronoi diagram is a partition of a plane into regions close to each of a given set of objects”
Here’s the Fortune’s algorithm in action, creating a Voronoi diagram out of random points. (Found on Wikipedia)
So @Fractality_alt is saying that you run that algorithm with random points on the window, which are the points where the glass will break. Then, convert the Voronoi regions into wedge parts, and like @pro_developer213 said, teleport them to replace the unbroken glass with them. Then, following @Fractality_alt’s instructions, apply VectorForce to each part? I’m not sure what that means, but it may be important.
@Fractality_alt’s way doesn’t make the glass break into exactly eight pieces, but it simulates broken glass.
You should put that code, like, in a modulescript, and require that code inside you main breaking glass code, since if you directly imbed it inside your main code, it might get messy
I looked at the picture in your original post. It looks like the eight triangular parts form out four rectangles:
I think you can find out the wedge parts’ width and height by subtracting the coordinates of the impact point and the x and y coordinates of the corners of the glass, since its dimensions are the same as the rectangles. Then, you just rotate the parts so that the crack aligns with the impact point.
Maybe, this would be easier for you?
In my opinion, this approach is harder to implement than the Fortune’s algorithm, because you have to do all the rotating, and positioning them so they all fit together. (The choice is up to you )
F point is the position of the Orange rectangle
E point is the position of the blue rectangle
G point is the position of the Green rectangle
H point is the position of the purple rectangle
I was thinking of the concept of not creating new instances of a wedge and then patch it up, making it look like the rectangular glass just broke, but instead actually cut up the glass so the rectangular glass actually ‘broke’
After quickly searching ‘cutting parts roblox’, I found this interesting post:
There’s a lot of solutions to that post, but the accepted answer was by @Syharaa:
Unfortunately, @EgoMoose’s roblox place for the answer is closed…
I found many alternate solutions other than @EgoMoose’s, like @Hexlinee’s, in the thread. And @skwoginc’s answer. Although I haven’t looked into all of them yet, but it’s worth looking into.