Game Development Reference
In-Depth Information
and Max Size (0.05) and a lower value for Max Energy (0.1). In the Particle
Renderer, it has a shortened Length Scale (1). All this was found by duplicating
Unity's Spark, relabeling it PistolSparks, and then dropping a copy of it into
the Scene window, tweaking to taste and pressing the Prefab Apply button.
Feel free to tweak further if you don't like my settings.
However, the critical setting that does need to be there is in the Particle
Animator section. The Autodestruct option is checked. This means that after
the particle fires once, it destroys itself. Since this particle system is going
to be instantiated at each point where the player fires his gun, it will be
important that once the spark fires, it dies and doesn't create a geyser of
sparks for every move.
Step 7: Play the game. Shoot around. Since the pistol is active from its
declaration, wherever the player fires, the little PistolSpark particle system
will be instantiated on the surfaces where the ray collides and will be
sparking away from the surface ( Figure 15.17 ). Fire away (we'll still be here
when you're done playing).
Figure 15.17 Instantiating a spark
where the ray shooting from the Main
Camera strikes a surface.
Step 8: Download and import Unity's explosion framework, “Detonator.”
This is available at http://unity3d.com/support/resources/unity-
extensions/explosion-framework . When downloaded, this will be
a unitypackage that can be brought in as usual via Assets>Import
Package>Custom Package.
Step 9: Download and import the package CCTV_Cameras.unitypackage
from the support web site ( http://www.Creating3dGames.com ). This will
include some assets already in the scene, and some (like a broken version
of the camera) that you do not have.
Quick Note about Detonator and Explosion Framework
These scripts all with a Detonator prefix are part of the Unity Explosion
Framework. On Unity's web site, Unity provides some very handy tools for
download and manual implementation. If you are working from the Unity
scenes provided on the web site ( http://www.Creating3dGames.com ),
Search WWH ::




Custom Search