29 March 2011

Shattering Glass

As I need to send a bullet through a pane of glass in my animation and failing miserably using PArray, I looked to other methods. I found success with a box cut up using ProCutter and a rigid body collection for the impact.

Firstly, a box is created to the size and thickness wanted for the pane. In the front view using the line tool, draw out the shatter lines. This will be used to split the box into segments for shattering.
It looks something like this...


Those lines are then extruded (modifiers > extrude) and sized so they completely intersect the box. The extruded lines must come out either side of the box and extend past all sides of the box for it to work.


By selecting one of the extruded line segments and going to compound objects and selecting ProCutter, click the box. It should split the box into segments like the image below.


By selecting the extruded lines and right clicking > hide selection and then building a simple frame, the object below is made.


A bullet I previously made for my gun was then imported and autokeyed to animate through the 'glass'. Add the frame, glass pieces and bullet to a rigid body collection. Give the frame a mass of 0 and set to unyielding so it won't move at all. Give each glass fragment a mass of 5 and set to inactive so it only moves on impact. Give the bullet a mass of 20 and also set to unyielding and concave mesh. The gravity in Havok's parameters can be played around with too to make the glass pieces fall differently. 

By adding a 'fracture' found on Reactor's toolbar, the glass panel will split more realistically when hit. Increase the energy loss to about 0.6. This will hold the pieces together just for a fraction of a second on impact so they don't explode out quite so violently.


Here is the animation...


With materials added, the cracks can be seen before the bullet hits so an identically sized but unshattered box is used. The unshattered box will be visible before impact then become invisible as the bullet strikes. The shattered box needs to be invisible first then appear on impact. This is done by opening the dope sheet (right click object > dope sheet) and going to the frame you want the switch to occur. Click the unshattered box and go to track > visiblity > add. Go to controller > assign and select on/off. Now select 'add key' and place one at the correct frame. This should make the line disappear to the right. Then the same method was used for each shattered piece of glass so the dope sheet looks like the image below.


And here is the final effect.


Nice.

No comments:

Post a Comment