Journal 148 — Unity Project Development, 2.5D Shooter
Objective: Add destruction and damage effects for 3 enemies
In the previous articles, I have been making refinements to my project. In this article, I will go over how I updated the enemy damage and destruction
For the B-2 stealth bomber final boss, I imported the FBX model over to Blender to make a short destruction animation, where the craft breaks apart and falls.
In Blender, I imported the FBX. In the import settings, include the check box for “image search” to also look for materials.
Once the model is imported, the materials loaded in correctly, but there is no image texture applied. With the model selected, you can view the Materials tab, and update the base color with the correct image texture.
Now, we can switch to the Viewport Shading, which will show the materials and texture applied.
Now I want to set up the camera view to render an animation. I can pick the X-Y-Z in the upper right of the workspace to change to a side view, same as the view during game play.
Then with the correct view, you can update the camera view to match.
In my case, the camera view was set too close to the craft, and also the camera type needs to be checked for perspective and orthographic settings.
Now with the correct camera view, I will apply the Blender Quick Effects called Quick Explode.
Let’s see these results.
Now, let’s start setting up the animation. During the animation, I need to adjust the camera view slightly to make sure to record the falling debris, so it looks reasonable during game play. Since the whole destruction sequence is less than 50 frames, I’ll just make a few key frames in the Camera tab and Transform tab to widen the camera shot and change the z-position to follow the debris.
Make sure to confirm the save location, and also confirm the animation is set to transparency.
Now, let’s see the recorded animation.
Now to import this into Unity and set each image to Sprite Texture.
Now I’ll make an empty game object and create the animation. I adjusted the sample rate to make it a bit slower.
For the damage effect, I used a fire particle effect.
I added a new empty game object to the enemy craft and I will enable this after the enemy is hit by a certain number of shots.
In the Enemy base script, I will set the damage particle effect active in the OnTriggerEnter function.
Then, when the enemy is destroyed, I will turn off the enemy craft collider and mesh renderer and instantiate the destroyed animation in its place.
Finally, let’s see this in action.
I have a few more major updates planned over the next few days. Thank you for your time!