Game Development Reference
In-Depth Information
Tracer Fire Obstacle
Another nifty renderer for visual effects is the Trail Renderer component (Figure 8-14 ). Aptly named,
it simply draws a trail behind a moving game object. It is typically used as a visual cue to indicate
speed as with an aircraft contrail, or even a combination of speed and realistic imagery such as
tracer fire. The tracer fire obstacle will be random tracer fire across the path of the player along the
elevated track.
Figure 8-14. The Trail Renderer component in the Inspector
For a quick demonstration, in the Hierarchy select Pendulum_01. In the Inspector, choose Add
Component ➤ Effects ➤ Trail Renderer.
The Trail Renderer can use an array of different materials for a variety of effects. Like the Line Renderer,
the Trail Renderer uses Particles materials. Leave the size of the Materials array indicated by the Size
property as 1. For Element 0, select the SimpleLaser material you created for the laser obstacle.
Time is the time in seconds the trail is to last. Start Width and End Width adjust the width of the
trail, which similar to the Line Render is also a 2D billboard. If you have colors in your material you
can leave the elements of the Colors property as is. Since our Laser material is white, go ahead and
make a colorful spectrum by choosing colors for all five elements.
If the game object is not moving for the period of time designated in Time , and Auto Destruct is
checked, the game object will be destroyed.
When you are finished experimenting with the pendulum's trail (Figure 8-15 ), disable or delete the
Trail Renderer component.
 
Search WWH ::




Custom Search