Particles Tutorial

From Bohemia Interactive Community
Revision as of 19:41, 7 August 2020 by Lou Montana (talk | contribs) (Page creation, WIP)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Template:SideTOC

Basics

A particle is a (to some extent, non-physical) 2D plane that always faces the camera, or (more rarely) a 3D model. It can be used to simulate ambient effects, such as dust, fire, water splash, wood splinters and even rock debris.

A particle source is a non-physical object that creates particles at a certain rate and position/velocity.

A particle (as well as a particle source) is local to the computer where the script has been called; one player could see smoke while another could see through without any issue.

Particles exist since Operation Flashpoint, but the first related command (drop) was only introduced in Operation Flashpoint: Resistance.
Particle source notions and commands were introduced in Arma, some commands were later added in Arma 3 (e.g setParticleFire, setParticleClass).


How to

Create a particle source

private _particleSource = "#particlesource" createVehicleLocal getPosATL player;
A particle source is local (and all the particle commands take a local argument too), hence createVehicleLocal usage.

3

_particleSource setParticleClass "ObjectDestructionFire1Smallx"; // defined in configFile >> "CfgCloudlets"

Set source parameters

// see ParticleArray for details on the array format
_particleSource setParticleParams
[
	["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
	"", "Billboard", 1, 3,						// animationName, type, timerPeriod, lifeTime
	[0,1.5,0],									// position relative to referenceObject
	[0,0,0],									// velocity
	0, 0.005, 0.003925, 0.1, [0.25, 0.75],		// rotation, weight, volume, rubbing, size
	[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],	// colors
	[1],										// animationPhase
	0, 0,										// randomDirectionPeriod, randomDirectionIntensity
	"", "",										// onTimer, beforeDestroy
	player,										// referenceObject
	0, false,									// angle, bounces
	-1, [],										// bounceOnSurface, emissiveColor
	[0,0,0]										// vectorDir
];

Set source drop interval

_particleSource setDropInterval 0.0625;

Set source drop circle

_particleSource setParticleCircle [3, [0,1,0]];

Set source random values

_particleSource setParticleRandom [0, [0.1, 0.1, 0.1], [0, 0, 0.5], 0, 0.1, [0, 0, 0, 0], 0, 0];

3

_particleSource setParticleFire [0.1, 0.5, 2];

Delete source

deleteVehicle _particleSource; // as simple as that

Use the drop command

The drop command only drops one particle. If multiple ones are needed, a loop (for, while) must be used.

// see ParticleArray for details on the array format
drop [
	["\A3\data_f\ParticleEffects\Universal\Universal", 16, 12, 0, 8],
	"", "Billboard", 1, 3,						// animationName, type, timerPeriod, lifeTime
	[0,1.5,0],									// position relative to referenceObject
	[0,0,0],									// velocity
	0, 0.005, 0.003925, 0.1, [0.25, 0.75],		// rotation, weight, volume, rubbing, size
	[[1,0,0,0.5], [0,1,0,1], [0,0,01,0.25]],	// colors
	[1],										// animationPhase
	0, 0,										// randomDirectionPeriod, randomDirectionIntensity
	"", "",										// onTimer, beforeDestroy
	player										// referenceObject
];


Full examples

See ParticleTemplates for Arma examples.

Template:wip


See also