Learn how to create a flexible realtime destruction system in Unity 5. In this course, game creators will learn how to create scalable choreographed destruction systems using rigid body dynamics, physics joints, particle systems, and C# scripts. Required Software: Unity v5.3.5.
Realtime destruction systems are a great way to enhance gameplay for many different types of games, and thanks to the performance of modern physics engines and increased power of gaming hardware, these systems are suitable for a wide range of applications. In this course, Authoring Real-time Destruction in Unity 5, you'll create a destruction FX system to simulate a wooden bridge collapse using rigid bodies, physics joints, and particle effects, as well as write some C# code to provide art direction control and allow you to choreograph the destruction sequence. First, you'll add different collider shapes to objects in the scene to determine best approximate fit. Next, you'll learn and understand the reasons for using fixed physics joints and then create one manually to see how they work. Finally, you'll learn about the benefits of particle effects and then create a debris emitter and dust emitter. By the end of this course, you'll be able to create a wide range of destruction systems, from bridges and buildings, to environments and vehicles. Required Software: Unity v5.3.5.
Michael Baker is a game developer and graphics production expert with more than 15 years experience in games and VFX production. He's worked on big licensed projects based on Star Wars and Alien, and developed software tools for the popular Bullet Physics Framework which powers countless authoring tools, feature films, and games. In 2013, he co-founded Codex Worlds, and indie AAA game studio based in Austin, Texas.
Course Overview Hey there, my name is Michael. I'm a certified Unity developer. Welcome to Authoring Real-Time Destruction in Unity 5. Real-time destruction systems are a great way to enhance game play for many different types of games, and thanks to the performance of modern physics engines and increased power of gaming hardware, these systems are suitable for a wide range of gaming applications. In this course, we'll create a destruction effect system to simulate a wooden bridge collapse using rigid bodies, physics joints, and particle effects. We'll also write some C sharp code to provide art direction control, and allow us to choreograph the destruction sequence. This is a really fun and flexible workflow which can be customized for a wide range of destruction systems, from bridges and buildings, to environments and vehicles. Download the project files and we'll get to work.
Creating an Activation System with C# Our next step is to add a script to the scene, which will give us more control over the activation sequence of the components of the bridge. You can see here that I have an image of shattered glass. This shows a classic spiderweb style pattern where the glass is shattered from a point of impact. This radial pattern is very common to destruction of rigid materials. We're going to write a script that will allow us to create a pattern like this from a point of origin, which radiates outward. And the way our script will work is, we will collect all the rigid bodies that are in range, and we'll specify that range in code, and then we'll use a timer to activate each piece in a radial pattern outward from that point of origin.
Adding Physics Joints Physics Joints allow us to define the relationship between rigid bodies and our simulation in different ways. And for a destruction sequence like the one that we're creating, it's important that we have control over how the bits and pieces of the structure are connected. Unity supports five different built in physics joint types. Those are spring, hinge, fixed, character, and configurable. Of those five we're going to focus on the fixed joint, which simply defines a rigid connection between two rigid bodies.
Adding Particle Effects Now it's time to add particle effects to our system. As you can see in the prototype here, we have particle effects being triggered based on the destruction of the structure itself. The way the system works is we have a script attached to each rigid body object in the structure, which tests for collisions and forces, and if a force threshold is exceeded, then particles are emitted. So this simulates the dust and debris that will be shaken loose during a destruction event like this.
Conclusion and System Applications Welcome to the final videos for this course. We'll take a look at a couple of additional examples, including a tower collapse and some explosion effects. We'll also look at some production considerations and optimization options for the systems and code included in the project. Be sure to download the final projects files to follow along and see how these final steps are assembled.