Particle collision with the world is a common requirement for realistic effects. Imagine spent shells from a machine gun clattering onto the ground. This kind of interaction is built into Cascade through the Collision module, which can be added to each system from the right-click menu below Color Over Life.
The main property for the Collision module is the Collision Completion Option, shown in the previous screenshot, which provides a roll-out list of possible results to occur upon a collision event. Kill will remove the collided particle. Freeze will stop it in its tracks. HaltCollisions will prevent further collisions. FreezeTranslation, Rotation, and Movement provide finer control over the stopping of the particle.
Another important property is Dir Scalar , further down, which is a value that can help close a gap or reduce overlap between killed particles and spawned particles in some situations. It will crop up in this example, which is going to not only show a particle collision but also spawn new particles at the hit location.
Open the map Packt_07_CollisionSpawn_Start.UDK from the provided content. This includes a ground plane, a tilted cube, lighting and a PlayerStart. Open the Content Browser and search for the particle system PacktFX.Cascade.SpawnCollisionStart which just includes two Emitters with Materials, the first being a red cross and the second a green tick. We won't be setting up the Lifetime, Size, Speed, or Spawn parameters. These have already been set, since otherwise we'd end up repeating the previous recipe all over again. Instead we'll focus on the Collision, Event, and Killing of the particles.
This works because the Initial Velocity of the Emitter Cross has a Velocity | Start Velocity | Distribution | Max and Min of X=1, Y=1, Z=90. The 1 is a very small increment for velocity. However, if it was set to 0.0 then we wouldn't be able to multiply it in the Emitter Tick's inherit velocity scalar. The Z=90 provides the downwards speed. In the Emitter Tick's EventRcvr Spawn | Velocity | Inherit Velocity Scale we multiply this Z value by 1.0 so it doesn't change. Then we take the Y value and multiple it by 90. So now we have two axes of speed ZY which gives us a 45' direction for the particles, which just appears to match the box. If, for instance, you rotate the Emitter actor 90' sideways and move it so the particles enter the box from a new angle, those values would not produce the same result. So some care has to be taken to get the conditions right. The screenshot below shows the intended result, and a completed Particle System asset PacktFX.Cascade.SpawnCollisionDemo is used in Packt_07_CollisionSpawn_DEMO.UDK.
One reason to kill particles is to optimize performance. In our current example, the Tick particles probably continue through the rainbow colored floor and continue downwards unseen and unneeded. To stop this, open the Particle System in Cascade and add to the Emitter Tick a Kill | Kill Height module. Set it to so the Absolute property is turned on (so the height is measured in the world), have a Height | Distribution | Constant of 0.0 and the Floor property turned on (so particles will be killed below the height we set). The following screenshot shows the settings required to stop the particles. It works here because the floor geometry happens to be at the given world Z height of 0.0.
3.141.199.122