Game Development Reference
In-Depth Information
For now, we'll look at how to shoot the cameras and how to show that the
cameras have been shot.
Instantiation
Instantiation is the idea of creating objects at runtime (when the game is
running). Actually, you've been doing it all along. When Unity runs the game,
the prefabs that have been placed in your scene via the Hierarchy are all
instantiated, and that's what the player actually runs through. This protects
the original assets and these instances of the objects can be destroyed or
otherwise changed and mucked up without long-term consequences.
Instantiation can also happen in a much more deliberate and controlled
manner as well, and can create some very interesting visual tricks. For
example, in our case we're going to play a bit of sleight of hand when the
player shoots a camera. When a camera is hit, we will destroy the existing
camera and instantiate a broken version of the camera at the same location. It
will appear that we've destroyed the camera, when we've just swapped it out.
We'll cover the trickery a little bit with a little explosion and some smoke.
But before we can do that we need to set up a gun-firing mechanism. And to
do that we need to make use of some Aegis arms.
Download from the supporting web site ( http://www.Creating3dGames
.com ) the AegisArms.unitypackage. This is an animated model (done in
Maya of course) that uses the same texture as Aegis's entire body. Upon
importing the package (Assets>Import Package>Custom Package), the
model AegisChung_Arms should be placed inside a Character Assets folder
in the Project panel ( Figure 15.11 ).
It has a much simpler rig than the whole body (for performance issues and
ease of animation). This rig can also be downloaded as the .mb file on the
supporting web site ( http://www.Creating3dGames.com ) if you'd like to see
how it's set up. There is very little new rigging technique there, so there is not
Figure 15.11 Aegis Chung arms
as included in the AegisArms
.unitypackage.
Search WWH ::




Custom Search