Game Development Reference
In-Depth Information
size to (100,1,100) and the Min and Max Emissions to 500 and 100,
respectively, it gives good snow coverage that can keep up with
the player's maximum speed.
Step 25. Finally, we are going to add little snow splats on the ground
when the snowflakes hit the ground. Create a new particle system
and call it Splat.
Step 26. Set the Min and Max Sizes to 0.1 and 0.3, the Min and Max
Energies to 0.3 and 0.3, the Min and Max Emissions to 10 and 10,
the World Velocity y value to 1, the Rnd Velocity to (1,1,1), and the
Ellipsoid to (0,0,0). Tick the One Shot box.
The emitter ellipsoid size of 0 will cause all particles to originate from
the same location, and One Shot will make the emitter shoot out all
particles at once instead of releasing them randomly. This creates
a little puff effect.
Step 27. Create a new prefab from the Splat and remove the Splat
object from the Hierarchy.
Step 28. Select the Snow particle system attached to the First Person
Controller in the Hierarchy. From the main menu select Component
> Particles > World Particle Collider. At this instance you will notice a
change in the behavior of the snow. It will start to bounce off everything!
Step 29. Create a JavaScript file called particlehit and add the code
in Listing 7.7 .
Listing 7.7 Script to Detect Individual Particle Collisions
and Instantiate Another Particle System
var splat: Transform;
function LateUpdate ()
var theParticles = particleEmitter.particles;
for (var i = 0; i < particleEmitter.particleCount; i++ )
if(theParticles[i].energy > particleEmitter.
var splatObj: Transform =
Quaternion.identity );
theParticles[i].energy = 0;
Destroy(splatObj.gameObject, 0.3);
particleEmitter.particles = theParticles;
Search Nedrilad ::

Custom Search