Control Point (particles): Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(Created page with 'In particles, a '''Control Point''' is a Vector variable that enables external values, like locations or colours, to be passed into a partic…')
 
mNo edit summary
 
(15 intermediate revisions by 7 users not shown)
Line 1: Line 1:
In [[:Category:Particle System|particles]], a '''Control Point''' is a [[Vector]] [[variable]] that enables external values, like locations or colours, to be passed into a particle system.
{{LanguageBar}}
{{back|Category:Particle System}}
{{toc-right}}


Each system can have up to 64 CPs, but the first, 0, is reserved as the system's [[origin]]. {{confirm|Children inherit the CPs of their parent.}}
'''Control Points''' are used to pass data into and between [[:Category:Particle System|particle systems]]. A system can have up to 64, each of which can store the following:


== Specifying ==
* An [[ParticleAttachment t|attachment type]]
* An attachment point
* An [[Vector|origin]]
* A [[matrix3x4 t|matrix]] (usually for rotation)
* An associated [[entity]]


; In the particle system
The meanings of these values are flexible however, and "cheats" such storing an [[RGB]] colour in the origin value are supported.
: Use one of the following [[Particle System Operators|operators]]:
:* [[Set Control Point Positions]]
:* [[Set Control Point to Particles' Center]]
:* [[Set Control Point To Player]]
:* [[Set child control points from particle positions]]
: To temporarily set a value, use the "Ctrl Pts" tab of the preview window.
; In a map
: Fill in the fields of the [[info_particle_system]] used to spawn the system.
; In code
: Call <code>[[CNewParticleEffect]]::[[SetControlPoint()]]</code>.
; In a QC file
: {{confirm|It is not possible to configure control points when [[compiling a model]].}} However, see the [[Position on Model Random]] initializer.


== Using ==
Particle systems inherit the control points of their parents.


There are many particle functions which can be configured to read values from a control point. Of particular interest are:
{{note|Control Points 0 (<code>vecOrigin</code>) and 1 (<code>vecStart</code>) are defined when dispatching from the server. Be aware of this when choosing which CPs to use in your system.}}


{{note|In order to use an [[info_target]] as a control point in a map, it needs to have the '''Transmit to Client''' spawnflag set.{{confirm}}}}
== Defining ==
=== Within a particle system ===
Use one of these Operators:
* [[Set Control Point Positions]]
* [[Set Control Point To Particles' Center]]
* [[Set Control Point To Player]]
* [[Set child control points from particle positions]]
* [[Movement Match Particle Velocities]]
=== In a map ===
Fill in the fields of the [[info particle system]] used to spawn the system. CP0 is the origin of the entity.
=== In code ===
See [[Particles In Code#Control points]].
=== In a QC ===
{{confirm|It is not possible to configure control points when [[compiling a model]].}} However, see the [[Position on Model Random]] initializer.
== Mapping to other values ==
<div style="display:inline-block;width:49%;vertical-align:top;">
=== Mapping functions ===
; Operators
; Operators
: ''Affect particles throughout their lifespan''
: [[Remap Control Point to Scalar]]
:* [[Remap Control Point to Scalar]]
: [[Remap Distance to Control Point to Scalar]]
:* [[Remap Distance to Control Point to Scalar]]
: [[Remap Distance Between Two Control Points to Scalar]]
:* [[Remap Distance Between Two Control Points to Scalar]]
; Initializers
; Initializers
: ''Affect particles when they are spawned''
: [[Remap Control Point to Vector]] {{note|There is no 'CP to Vector' operator, just this initializer. The reasons for this omission are not clear.}}
:* [[Remap Control Point to Vector]] {{note|There is no 'CP to Vector' operator, just this initializer. The reasons for this omission are not clear.}}
: [[Remap Control Point to Scalar]]
:* [[Remap Control Point to Scalar]]
: [[Remap Initial Distance to Control Point to Scalar]]
:* [[Remap Initial Distance to Control Point to Scalar]]
</div>
 
Using these functions, a CP's value(s) can control the following particle values:


<div style="display:inline-block;width:49%;vertical-align:top;">
=== Potential targets ===
<div style="display:inline-block;width:49%;vertical-align:top;">
; Scalar
; Scalar
: Lifespan
: Lifespan
: Creation time {{todo|Same idea as pre-ageing, or affecting spawn time?}}
: Creation time
: Radius
: Radius
: Roll speed
: Roll speed
: Alpha
: Alpha
: Alpha alternate {{todo}}
: Alpha alternate
: Sequence number
: Sequence number
: Sequence number 1 {{todo}}
: Sequence number 1
: Trail length
: Trail length
: Particle ID
: Particle ID
: Yaw
: Yaw
</div>
<div style="display:inline-block;width:49%;vertical-align:top;">
; Vector
; Vector
: Position
: Position
: Roll
: Roll
: RGB Colour ([[normal]]ised)
: RGB Colour ([[normal]]ised)
</div>
</div>
=== Other ===
These sample values from CPs rather than remapping their literal values:
* [[Color Light from Control Point]]
* [[Velocity Inherit from Control Point]]
== Spawning children at control points ==
By default, child systems spawn at their parent's origin. To change this, use one of the "Position" Initializers with a reference to the appropriate CP number.


[[Category:Particle System]]
[[Category:Particle System]]
[[Category:Glossary]]
[[Category:Glossary]]

Latest revision as of 23:14, 2 September 2024

English (en)中文 (zh)Translate (Translate)
Category:Particle System

Control Points are used to pass data into and between particle systems. A system can have up to 64, each of which can store the following:

The meanings of these values are flexible however, and "cheats" such storing an RGB colour in the origin value are supported.

Particle systems inherit the control points of their parents.

Note.pngNote:Control Points 0 (vecOrigin) and 1 (vecStart) are defined when dispatching from the server. Be aware of this when choosing which CPs to use in your system.
Note.pngNote:In order to use an info_target as a control point in a map, it needs to have the Transmit to Client spawnflag set.[confirm]

Defining

Within a particle system

Use one of these Operators:

In a map

Fill in the fields of the info particle system used to spawn the system. CP0 is the origin of the entity.

In code

See Particles In Code#Control points.

In a QC

Confirm:It is not possible to configure control points when compiling a model.

However, see the Position on Model Random initializer.

Mapping to other values

Mapping functions

Operators
Remap Control Point to Scalar
Remap Distance to Control Point to Scalar
Remap Distance Between Two Control Points to Scalar
Initializers
Remap Control Point to Vector
Note.pngNote:There is no 'CP to Vector' operator, just this initializer. The reasons for this omission are not clear.
Remap Control Point to Scalar
Remap Initial Distance to Control Point to Scalar

Potential targets

Scalar
Lifespan
Creation time
Radius
Roll speed
Alpha
Alpha alternate
Sequence number
Sequence number 1
Trail length
Particle ID
Yaw
Vector
Position
Roll
RGB Colour (normalised)

Other

These sample values from CPs rather than remapping their literal values:

Spawning children at control points

By default, child systems spawn at their parent's origin. To change this, use one of the "Position" Initializers with a reference to the appropriate CP number.