Particles Tutorial: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - "{{Feature | Informative | " to "{{Feature|informative|") |
Lou Montana (talk | contribs) m (Some wiki formatting) |
||
Line 1: | Line 1: | ||
{{TOC|side}} | {{TOC|side}} | ||
A '''{{Link|https://en.wikipedia.org/wiki/Particle_system|particle}}''' is a (to some extent, non-physical) 2D plane that always faces the camera, or (more rarely) a 3D model. | A '''{{Link|https://en.wikipedia.org/wiki/Particle_system|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. | It can be used to simulate ambient effects, such as dust, fire, water splash, wood splinters and even rock debris. | ||
Line 9: | Line 7: | ||
A particle (as well as a particle source) is '''[[Multiplayer Scripting#Locality|local]]''' to the computer where the script has been called; one player could see smoke while another could see through without any issue. | A particle (as well as a particle source) is '''[[Multiplayer Scripting#Locality|local]]''' to the computer where the script has been called; one player could see smoke while another could see through without any issue. | ||
{{Feature|informative|Particles exist since | {{Feature|informative|Particles exist since {{GameCategory|ofp|link= y}}, but the first related command ([[drop]]) was only introduced in {{GameCategory|ofpr|link= y}}.<br> | ||
Particle source notions and commands were introduced in {{arma1}}, some commands were later added in {{arma3}} (e.g [[setParticleFire]], [[setParticleClass]]).}} | Particle source notions and commands were introduced in {{GameCategory|arma1|link= y}}, some commands were later added in {{GameCategory|arma3|link= y}} (e.g [[setParticleFire]], [[setParticleClass]]).}} | ||
== How | == How To == | ||
=== Create a | === Create a Particle Source === | ||
<sqf>private _particleSource = "#particlesource" createVehicleLocal ASLToAGL getPosASL player;</sqf> | <sqf>private _particleSource = "#particlesource" createVehicleLocal ASLToAGL getPosASL player;</sqf> | ||
Line 21: | Line 19: | ||
{{Feature|informative|A particle source is '''[[Multiplayer Scripting#Locality|local]]''' (and all the particle commands take a local argument too), hence [[createVehicleLocal]] usage.}} | {{Feature|informative|A particle source is '''[[Multiplayer Scripting#Locality|local]]''' (and all the particle commands take a local argument too), hence [[createVehicleLocal]] usage.}} | ||
{{ArgTitle|3|Set | {{ArgTitle|3|Set Source Class|{{GVI|arma3|0.50}}}} | ||
<sqf>_particleSource setParticleClass "ObjectDestructionFire1Smallx"; // defined in configFile >> "CfgCloudlets"</sqf> | <sqf>_particleSource setParticleClass "ObjectDestructionFire1Smallx"; // defined in configFile >> "CfgCloudlets"</sqf> | ||
Line 27: | Line 25: | ||
{{Feature|informative|Particle source class must be defined in game [[configFile|config]] and '''cannot''' be declared in [[missionConfigFile]] or [[campaignConfigFile]]. See [[Arma 3: Particle Effects]] for more information.}} | {{Feature|informative|Particle source class must be defined in game [[configFile|config]] and '''cannot''' be declared in [[missionConfigFile]] or [[campaignConfigFile]]. See [[Arma 3: Particle Effects]] for more information.}} | ||
=== Set | === Set Source Parameters === | ||
See [[ParticleArray]] for details on the array format. | See [[ParticleArray]] for details on the array format. | ||
Line 49: | Line 47: | ||
</sqf> | </sqf> | ||
=== Set | === Set Source Drop Interval === | ||
<sqf>_particleSource setDropInterval 0.0625; // duration between drops</sqf> | <sqf>_particleSource setDropInterval 0.0625; // duration between drops</sqf> | ||
=== Set | === Set Source Drop Circle === | ||
<sqf>_particleSource setParticleCircle [3, [0,1,0]]; // [circle radius, velocity]</sqf> | <sqf>_particleSource setParticleCircle [3, [0,1,0]]; // [circle radius, velocity]</sqf> | ||
=== Set | === Set Source Random Values === | ||
<sqf> | <sqf> | ||
Line 75: | Line 73: | ||
</sqf> | </sqf> | ||
{{ArgTitle|3|Set | {{ArgTitle|3|Set Source Fire Properties|{{GVI|arma3|1.08}}}} | ||
<sqf>_particleSource setParticleFire [0.1, 0.5, 2]; // [coreIntensity, coreDistance, damageTime]</sqf> | <sqf>_particleSource setParticleFire [0.1, 0.5, 2]; // [coreIntensity, coreDistance, damageTime]</sqf> | ||
=== Delete | === Delete Source === | ||
<sqf>deleteVehicle _particleSource; // as simple as that</sqf> | <sqf>deleteVehicle _particleSource; // as simple as that</sqf> | ||
=== Use the [[drop]] | === Use the [[drop]] Command === | ||
The [[drop]] command only drops one particle. If multiple ones are needed, a loop ([[for]], [[while]]) must be used. | The [[drop]] command only drops one particle. If multiple ones are needed, a loop ([[for]], [[while]]) must be used. | ||
Line 116: | Line 114: | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
ps1 = "#particlesource" createVehicleLocal _posATL; | ps1 = "#particlesource" createVehicleLocal _posATL; | ||
Line 130: | Line 127: | ||
<sqf>execVM "particles.sqf";</sqf> | <sqf>execVM "particles.sqf";</sqf> | ||
This format deletes all previous effects and still allows you to use the [[Arma 3: Debug Console|Debug Console]] in order to adjust particle source settings thanks to the usage of global variables (here, {{hl|ps1}} and {{hl|ps2}}) | This format deletes all previous effects and still allows you to use the [[Arma 3: Debug Console|Debug Console]] in order to adjust particle source settings thanks to the usage of global variables (here, {{hl|ps1}} and {{hl|ps2}}). | ||
=== Using a Mod === | === Using a Mod === | ||
Line 138: | Line 135: | ||
== | == Examples == | ||
{{Feature|informative|The following examples are for {{arma2}} and later titles. For {{arma1}} examples, see [[ParticleTemplates]].}} | {{Feature|informative|The following examples are for {{arma2}} and later titles. For {{arma1}} examples, see [[ParticleTemplates]].}} | ||
{{Feature | important | For games other than {{arma3}}: | {{Feature|important| | ||
For games other than {{arma3}}: | |||
* remove [[private]] usage | * remove [[private]] usage | ||
* replace {{hl|\A3\Data_F\}} with: | * replace {{hl|\A3\Data_F\}} with: | ||
Line 430: | Line 428: | ||
{{Clear}} | {{Clear}} | ||
== See | == See Also == | ||
* | * {{Link|:Category:Particle System|Particle System category}} | ||
* [[ParticleArray]] - particle array format | * [[ParticleArray]] - particle array format | ||
[[Category:Arma Scripting Tutorials]] | [[Category:Arma Scripting Tutorials]] |
Revision as of 20:52, 4 July 2024
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.
How To
Create a Particle Source
Set Source Class
Set Source Parameters
See ParticleArray for details on the array format.
Set Source Drop Interval
Set Source Drop Circle
Set Source Random Values
Set Source Fire Properties
Delete Source
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.
Design Workflow
In order to determine one particle behaviour, a simple drop usage in the Debug Console can do; but seeing the complete end result can be another task at hand.
Using a Script
One way to design your effect is to have an SQF file, named e.g "particles.sqf", filled with your code:
and run with
This format deletes all previous effects and still allows you to use the Debug Console in order to adjust particle source settings thanks to the usage of global variables (here, ps1 and ps2).
Using a Mod
Emitter 3Ditor (a real-time WYSIWYG particle source editor) adds and uses particle and light emitters in your scenarios without any scripting nor mod dependency.
Steam page - Forums post
Examples
Burning Vehicle Fire Look-Alike
Fire
Floating Orb
Heavy Oily Smoke (Small)
Heavy Oily Smoke (Medium)
Heavy Oily Smoke (Large)
Light Wood Smoke (Small)
Light Wood Smoke (Medium)
Light Wood Smoke (Large)
Mixed Smoke (Small)
Mixed Smoke (Medium)
Mixed Smoke (Large)
Rock Shower
See Also
- Particle System category
- ParticleArray - particle array format