How it works...

two objects, a normal one and a fractured one built out of a number of pieces. The normal object works as any other game object in our game. The fractured game object is spawned only when we destroy the normal object. We save the normal object's velocity (its rigid body velocity in this example) every frame to be able to add this velocity to our spawned, fractured pieces. This makes them continue movement after the normal object was destroyed.

In this recipe, we created two objects, a normal one and a fractured one built out of a number of pieces. The normal object works as any other game object in our game. The fractured game object is spawned only when we destroy the normal object. We save the normal object's velocity (its rigid body velocity in this example) every frame to be able to add this velocity to our spawned, fractured pieces. This makes them continue movement after the normal object was destroyed. There's more...

You can use this simple technique to create even more complex objects (destructible barrels where each plank is a separate object is a good example). There are also different fracture systems available on the Asset Store (try searching for "fracture," "shatter," or "destructible").

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.118.93.175