- Home /
Shattering Glass
Is it possible to create the effect of glass being broken in Unity 3D?
How would you achieve it?
Answer by Murcho · Feb 20, 2010 at 11:13 PM
The easiest way would be to have 2 objects, a solid mesh for your pane of glass, and another mesh that has been broken up earlier. On contact with the glass from a bullet, explosion, punch, etc. you simply swap the meshes, and the second mesh you could place physics colliders on to get a nice effect.
To go all out, you could calculate the breaking of the mesh based on point of impact, which is what a lot of the more advanced games do these days, however it's a larger task that requires a fair portion of maths. Here is a paper on the procedural maths behind creating realistic shattering. As you can see it's quite complicated, however if you have the processing power and the mathematical ability, there is no reason you shouldn't attempt this technique.
I think the simpler idea is enough. But thank you for the paper.
Answer by Jason_DB · Feb 21, 2010 at 02:45 PM
I would just like to add to what Murcho said (his idea is probably the best way) that you could also use a particle effect of glass shards in conjunction with Murcho's idea to make it a little more realistic, also you could make 2 or 3 alternate meshes for the broken glass and pick one of them at random to avoid the appearance of it always breaking the same way without getting into the heavy procedural stuff (if the glass object will be reused enough to make that logical).
Thank you, do you have any references on using particles to simulate glass shards?
Sorry, but I've never been particularly great with particle effects; I've only seen it done in other games.
Answer by lollevel · Feb 21, 2010 at 02:12 AM
You could also make the glass with the pieces already separated and each with a rigidbody, then make it sleep with rigidbody.Sleep() and awake it when it was hit (onTrigger for example), but the easier way is just like murcho's said.
have a look at this example by drJones maybe it's what you need
Answer by EntiTkU · Aug 02, 2020 at 08:30 AM
Ok, but how do i make shattered glass-like mesh? i mean cut in pieces. Any programs other than blender?
Your answer
![](https://koobas.hobune.stream/wayback/20220612080756im_/https://answers.unity.com/themes/thub/images/avi.jpg)