u should use my idea but with very much break glasses and math.random() but to detect if the glass is touched by the explozion u need to use
UR_EXPLOZION.Hit:Connect(function(part)
if part.Name == "UR_GLASS_NAME" then
--Do stuff
end)
end
u should use my idea but with very much break glasses and math.random() but to detect if the glass is touched by the explozion u need to use
UR_EXPLOZION.Hit:Connect(function(part)
if part.Name == "UR_GLASS_NAME" then
--Do stuff
end)
end
I’m not talking about when to break the glass.
I’m talking about generating eight pieces of glasses.
sorry i can’t make what u want
I found something on roblox forums:
Hope it helps : )
I saw that, but I still can’t figure out how to make it.(Before you replied me XD)
Well, in that post @Fractality_alt says:
I did a quick search on Fortune’s algorithm.
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.
Yeah, but umm. How can I calculate it? bruh
I found a detailed explanation on the web, but I don’t understand that much advanced math, so I can’t help you that much .
But hey, on the bright side I found some code for the Fortune’s algorithm written in Lua.
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
Bruh that would will be very hard work.
Come on, Thousands of lines.
Yeah, sadly it is
If you’re not that much of a math wiz, I’ll try to find something easier for you.
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 )
I wanted to do it like you said, but I don’t what I’m gonna do with CFrame.
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
So, the triangles in the same rectangle has the same size and position.
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.
I think I should use the cut technology.
Bc it looks easier.
Bruh it’s hard.
I guess I should make a handmade one.
Maybe make the glass a model made by more parts and when .Touched, use BreakJoints function.
Try to actually put some hard work in, and not pretty much ask for a ready-made script.
"Bruh that would will be very hard work.
Come on, Thousands of lines."
is not the right attitude.
The Scripting Support category is more of a place for asking others for help on issues you are facing or perhaps pointing you in the right direction, but it’s not a place to ask for others to write you working scripts.
A much simpler method to simulate breaking glass would probably to have the broken pieces in the frame with their transparency set to 1, cancollide false and all parts anchored then when it is broken get the script to remove the single intact glass piece then set the broken pieces transparency to the level you use for windows, set them to cancollide true and then unanchor them. This should give you the desired effect.