Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to make a simulation with stone thrown through a glass window. How can I accomplish that?

I mean, I was thinking about making a 3D model of a stone and glass in 3D Studio Max 2012, shatter the glass and export both to XNA 4.0 as .x models. Then in XNA make the animation - writing my own physics engine. Is it possible that way? Is it possible to destroy the glass in XNA after impact or should I do it in 3DS Max? By 'destroying the glass' I mean disconnect some previously shattered glass bits from each others, because depending on the start-speed and weight of the stone and resistance (hardness?) of the glass (all user-defined) the bits will disconnect from each other in different ways.

share|improve this question

Voronoi shatter is one approach that creates fairly realistic shatter for eg. toughened glass which has the remarkable ability to shatter into small, typically convex fragments due to structural changes to the glass during manufacturing. Also, given you have a pane of glass, you will only need 2D Voronoi implementation, not 3D.

share|improve this answer

Automatically generating shattered pieces from an initially-whole mesh is pretty tricky, I would think. If you're just interested in simulating the dynamics of the shards as they fly through the air, collide etc. then I'd start with a pre-shattered mesh, using breakable constraints or something to hold the pieces together until they're pulled apart with enough force.

share|improve this answer
Hi Nathan (again), have you worked on this task after 2011? Can you give any more hints? Thx – karlphillip Aug 12 '14 at 12:38
@karlphillip I did work on a demo using PhysX Destruction, though I personally only did rendering stuff, not any physics stuff on that project. The PhysX tech works by generating pre-shattered pieces in a DCC tool, and swapping them in for the unbroken mesh when damage occurs. – Nathan Reed Aug 18 '14 at 6:15
Great, thanks!! – karlphillip Aug 18 '14 at 12:18

If you download the Bullet Physics Library it has a sample that includes shattering glass, and you would need something like bullet in any game with shattering glass.

Edit: Bullet would be a great demonstration to model your own engine after.

share|improve this answer

Make an unshattered pane and a shattered pane. When you get the collision turn off the unshattered version and start using the shattered pane.

If you are throwing one stone (of a somewhat consistent size) at a window then you can get a long way with your 3d model of the broken pane (model the shards in place in the pane and then run a simple physics simulation on each of the shards to simulate them falling/flying). Unless the camera is very close (or in slow-motion) you shouldn't need to do collisions between the pieces - just with the surrounding geometry (ground plane?). Don't forget to spray some particle effects for the cloud of smaller glass particles that accompany the shatter.

If you make the broken pane with the assumption that the stone is hitting the center then you can scale the pieces based on the actual hit position to get a pretty good looking break for most hits.

share|improve this answer

Thank you really much for your answers and priceless help. I finally managed to build the project. I tried all your sugestions and in the end chose partly my own way for this simulation.

I used bulledsharp (bullet physics wrapper for c#) for physics engine, but it is important to use the most recent one, compiled by yourself with bulletsharp source from sourceforge svn as well as fresh bullet physics sources itself. Not the one precompiled .dll's, available to download from websites. The version precompiled was too old for me and did not include some precious features developed further. What I also learned is that for simple simulations where you do not need advanced graphics it is better to use older 3dsmax, ie 2011 (not the most recent 2012), to develop model etc. Mainly because there are more plugins and exporters. Whats more it is really helpful to check out the tutorials in all available frameworks (sharpdx, xna, xna4, slimdx, c++ and other).

Finally, my approach was to build the glass wall using really small cube pieces. Of course to make the simulation run you must have really powerful machine. In case you have something less powerfull you can use bigger cubes. It is important to make all the cubes created with sleeping island state. Now, every piece have his representation in two dimentional array of floats. The number there indicates what is the connection strength between two cubes. When the stone is thrown, and collsiion is detected, the force is being computed for each cube in the wall (including stone mass, and velocity, cube mass and size and distance from the center of collision) and subtracted from the array in the circle-like pattern. Those cubes which after subtraction has zero or less connection strength are made active. This causes the cubs to move.

This is it. Thanks for your help.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.