07. Particles

Particle effects enhance the visual appearance of the Sydewinder game and help to display physical effects such as shock-waves or propulsion effects. Particle effects can be continuous effects such as jet engine efflux or smoke trails, and one time effects such as explosions or glowing sparks.

The easiest way to create a new particle effect is through the CRYENGINE Sandbox. For more information on the Particle Editor in CRYENGINE please refer to the Particle System chapter. The Sydewinder template consists of a few particle effects that have been created using the Sandbox. These include weapon trails, engine trails and explosion effects in the canyon level.

An example of particle effects in Sydewinder.

Loading a Particle Effect

To interact with a particle effect you first need to find the effect by name (as specified in the CRYENGINE Sandbox). Use the FindEffect method on the ParticleManager class.

DestroyParticleEffect = Engine.ParticleManager.FindEffect("spaceship.Destruction.explosion_blue");

The particle can be immediately spawned at a specific position.

DestroyParticleEffect.Spawn(Entity.Position);

Particle Emitters

A ParticleEmitter follows a specific object and prevents certain effects from appearing at a certain position. The ParticleEmitter is bound to an entity slot. For example the player's ship fires projectiles which are small default entities that are not visible since they have no model assigned, but the projectile's visual appearance is represented by a yellow flame particle effect which follows the projectile.

// Retrieve particle effect.
var weaponBulletParticleEffect = Engine.ParticleManager.FindEffect("spaceship.Weapon.player_shot");
// Assign the particle effect to a emitter slot.
projectileEntity.LoadParticleEmitter(1, weaponBulletParticleEffect);

After you get the flame effect from the canyon level assets you can immediately load it into slot 1 by calling the LoadParticleEmitter method. As long as the entity is not removed the continuous effect will follow the entity.

// Kill the particle trail of the bullet
projectileEntity.GetParticleEmitter(1).Kill();

After the projectile is released you need to call the Kill method on the particle emitter to stop it (for example after a bullet collision with an enemy). The engine removes the effect without a delay but without ending the effect immediately.