I've been making wide use of the BallisticProjectile class to create ballistic particles generated by explosive events. For example, when a plane crashes and explodes, I have one or more ballistic particles thrown from the event. Tied to these particles are a fire and a smoke effect, to simulate a firey piece of debris with a smoke trail arcing through the air. Another example of such a ballistic projectile is a distress flare fired randomly from a destroyed ship, to which are tied three different effects: a burning flare texture, a lightpointactor that illuminates the immediate surrounds, and a smoke trail to suggest the smouldering propellant.
Destroying such particles was controlled in BallisticProjectile.class only by the timing of the effect. For instance, my distress flare could continue to light the ground/water
from below as the ballistic particle continued to sink through the earth, the glow becoming larger and fainter in the reverse sequence to what happened while in the air and approaching the surface. Therefore I had to carefully control the timing of the effect, trying to avoid these sub-surface oddities.
And so a little while back I made changes to BallisticProjectile.class to destroy ballistic particles upon contact with land or water, calling new methods in Explosions.class which also create a little dust cloud or water splash upon contact with the surface. Again, this contact also removes ('destroys') the ballistic projectile and any effects tied to it, thereby eliminating all concerns of adjusting the effect live time. And of course this increases efficiency by immediately ceasing the continuance of the particle and the generation of the effects tied to it.
As part of all this re-jigging I had (or thought I had) tied the numerous blasted pieces from destroyed bridges to ballistic projectiles. That's because I wanted a dust/splash effect for each piece upon hitting the surface. Strangely, though, I found that I had to still give the effect for the bridge part a downward VertAccel value, this of course being -9.8 for 1G acceleration. While the water splash or land hit dust cloud effects were being created as expected, they were NOT tied to the bridge pieces as they hit the surface. These two oddities told me that the bridge parts flying through the air were not actually tied to the ballistic projectiles.
I discovered that the effect type plays a role. An AnimatedSprite type of effect (like the glowing texture for the distress flare) will remain tied to the ballistic projectile. A TSmokeTrailParams or TParticlesSystemParams effect must be continuously generating new trail segments or particles. But a TParticlesSystemParams type effect as for the bridge pieces flung away from a destroyed bridge remains as just the one particle for the duration of its existence. And for some reason departs from the ballistic projectile one is attempting to tie it to. Too bad, because the TParticlesSystemParams effect allows each new particle to start with a different rotational orientation, which is ideal when many identical particles are drawn together. If all have the same rotational orientation, spinning exactly in unison to make water ballet dancers green with envy, is so horribly artificial looking.
Yesterday I revistied this, and settled on the following approach in order to keep each bridge piece tied correctly to the ballistic particle and thereby have its impact dust/splash properly coincident. I have had to use the AnimatedSprite class for the bridge particles. But because all such textures rotate exactly in unison, I have made three different effects, each using a different texture, drawn at a different size, and having a different rotational speed. This looks OK. And now every one of these dozens of pieces makes a correctly located impact effect, as I have wanted to get since starting this chapter of my effects adventures.
The following 4-panel sequence shows the result. The time sequence goes forward in time from top to bottom. The first panel is just after bomb bursting, and you see the initial splashes from the high velocity shrapnel. In subsequent frames pieces of the blasted debris are making splashes (or dust clouds, as seen to the right in the last frame) as they hit the surface over a period of several seconds. Note the three different effects/textures for the debris bits, rotating at three different speeds so as to break up the otherwise severe regimentation if just one effect/texture was used
[click for larger]