DinoFracture 2.11.1
A Dynamic Fracture Library
Loading...
Searching...
No Matches

Explode Cube On Drop

Description

This tutorial will walk through the basic steps to create a cube that falls and fractures in a dramatic way.

The end result will look like:

Create the Basic Scene Setup

  1. Create a new blank scene.
  2. Add a cube object for the floor.
  3. Set the scale of the floor cube to [5, 0.25, 5]
  4. Add another cube, which will be fractured.
  5. Set the fracture cube's scale to [0.5, 0.5, 0.5]
  6. Move the fracture cube above the floor to location [0, 3, 0]
  7. Add a rigid body component to the fracture cube, leaving the default properties.
  8. Optionally adjust the camera to have a nice view of the scene.

The scene should now look similar to:

If you hit play, you should see the cube drop and come to a stop.

Adding the Fracture Geometry component

  1. On the fracture cube, add a Pre-Fractured Geometry component or a Runtime Fractured Geometry component.
    • If using the Pre-Fractured Geometry component, make sure to click the Create Fractures button before running the game.
  2. Add a Fracture On Collision component to the cube. Leave the defaults.
Note
You can toggle between a Pre-Fractured Geometry component and a Runtime Fractured Geometry component via the component's context menu.

After hitting play, the cube will drop and fracture, but the result will look bland.

Adding Dynamic Explosion

  1. On the cube game object, add a Explode On Fracture component.
  2. Set the Force to 5 and the Radius to 0.5

Hitting play will show a subtle explosion:

Final Touches

  1. To improve performance at runtime, use the Pre-Fractured Geometry component. Click the Create Fractures at the bottom of the component. No other changes needed.
    Note
    If you added a Runtime Fractured Geometry component already, you can use the component's context menu to convert it to a Pre-Fractured Geometry component.
  2. Under the Fracture Properties section in the fracture geometry component, change the Num Pieces and Num Iterations to 3. This will generate about 3^3 = 27 pieces.
  3. Change the Force value on the Explode On Fracture component to 12 for a more explosive oomph.
  4. Optionally add a Play Sound On Fracture component to play a sound effect after the cube breaks.