Particles Tutorial: Difference between revisions
Lou Montana (talk | contribs) m (Text replacement - "ASLtoAGL" to "ASLToAGL") |
Lou Montana (talk | contribs) m (Text replacement - "{{Link|:Category:" to "{{Link|Category:") |
||
(6 intermediate revisions by the same user not shown) | |||
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 '''{{ | |||
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 | | {{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> | ||
{{Feature | | {{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> | ||
{{Feature | | {{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 106: | Line 104: | ||
== Design Workflow == | == Design Workflow == | ||
In order to determine ''one'' particle behaviour, a simple [[drop]] usage in the [[Arma 3 Debug Console|Debug Console]] can do; | In order to determine ''one'' particle behaviour, a simple [[drop]] usage in the [[Arma 3: Debug Console|Debug Console]] can do; | ||
but seeing the complete end result can be another task at hand. | but seeing the complete end result can be another task at hand. | ||
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 === | ||
'''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'''.<br> | '''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'''.<br> | ||
{{ | {{Link|link= https://steamcommunity.com/sharedfiles/filedetails/?id=1613905318|text= Steam page}} - {{Link|link= https://forums.bohemia.net/forums/topic/221163-emitter-3ditor/|text= Forums post}} | ||
== | == Examples == | ||
{{Feature | | {{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 155: | Line 153: | ||
=== Burning Vehicle Fire Look-Alike === | === Burning Vehicle Fire Look-Alike === | ||
[[ | [[File:PE_BurningVehicleLookAlike.jpg|thumb|left|100px|Burning vehicle fire look-alike]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 192: | Line 190: | ||
=== Fire === | === Fire === | ||
[[ | [[File:PE_fire.jpg|thumb|left|100px|Fire]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 219: | Line 217: | ||
=== Floating Orb === | === Floating Orb === | ||
[[ | [[File:PE_FloatingOrb.jpg|thumb|left|100px|Floating Orb]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 234: | Line 232: | ||
=== Heavy Oily Smoke (Small) === | === Heavy Oily Smoke (Small) === | ||
[[ | [[File:PE_HeavyOilySmokeSmall.jpg|thumb|left|100px|Heavy Oily Smoke (Small)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 251: | Line 249: | ||
=== Heavy Oily Smoke (Medium) === | === Heavy Oily Smoke (Medium) === | ||
[[ | [[File:PE_HeavyOilySmokeMedium.jpg|thumb|left|100px|Heavy Oily Smoke (Medium)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 268: | Line 266: | ||
=== Heavy Oily Smoke (Large) === | === Heavy Oily Smoke (Large) === | ||
[[ | [[File:PE_HeavyOilySmokeLarge.jpg|thumb|left|100px|Heavy Oily Smoke (Large)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 285: | Line 283: | ||
=== Light Wood Smoke (Small) === | === Light Wood Smoke (Small) === | ||
[[ | [[File:PE_LightWoodSmokeSmall.jpg|thumb|left|100px|Light Wood Smoke (Small)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 302: | Line 300: | ||
=== Light Wood Smoke (Medium) === | === Light Wood Smoke (Medium) === | ||
[[ | [[File:PE_LightWoodSmokeMedium.jpg|thumb|left|100px|Light Wood Smoke (Medium)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 319: | Line 317: | ||
=== Light Wood Smoke (Large) === | === Light Wood Smoke (Large) === | ||
[[ | [[File:PE_LightWoodSmokeLarge.jpg|thumb|left|100px|Light Wood Smoke (Large)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 336: | Line 334: | ||
=== Mixed Smoke (Small) === | === Mixed Smoke (Small) === | ||
[[ | [[File:PE_MixedSmokeSmall.jpg|thumb|left|100px|Mixed Smoke (Small)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 362: | Line 360: | ||
=== Mixed Smoke (Medium) === | === Mixed Smoke (Medium) === | ||
[[ | [[File:PE_MixedSmokeMedium.jpg|thumb|left|100px|Mixed Smoke (Medium)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 388: | Line 386: | ||
=== Mixed Smoke (Large) === | === Mixed Smoke (Large) === | ||
[[ | [[File:PE_MixedSmokeLarge.jpg|thumb|left|100px|Mixed Smoke (Large)]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
Line 414: | Line 412: | ||
=== Rock Shower === | === Rock Shower === | ||
[[ | [[File:PE_RockShower.jpg|thumb|left|100px|Rock Shower]] | ||
<sqf> | <sqf> | ||
private _posATL = player modelToWorld [0,10,0]; | private _posATL = player modelToWorld [0,10,0]; | ||
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]] |
Latest revision as of 14:52, 16 October 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