Particles on models

From Valve Developer Community
Jump to: navigation, search

Particles can be attached to models with the $keyvalues QC command. Adding a particles section to it allows any number of effects to spawn on the model, and optionally to follow it around.

Note.pngNote:Particles will not appear if the model is used with prop_static.
Note.pngNote:In most cases, particles attached to a player model will end up visible in first person, but relative to where the 3d playermodel would be in that spot. They will also sometimes disappear when the player dies.
Tip.pngTip:To attach particles to models programmatically, see Particles In Code.
Fire particles in Left 4 Dead 2 which were added to the 3rd person player models wrist. But for some reason they appear in the 1st person where the 3rd person models wrists are.

Syntax

Within the $keyvalues block:

particles
{
	effect
	{
		name			"<particle effect name>"
		attachment_type		<attachment type>
		attachment_point	<name of attachment point>
	}

	<further effects>
}
name
The name of a particle system. NOT the name of a .pcf file!
attachment_type
Must match one of the valid attachment types. These are:
start_at_origin
start_at_attachment
The effect spawns at the origin or an attachment of the model. After this, it moves independently. Good for very short effects like explosions or blood spurts.
follow_origin
follow_attachment
The effect spawns at the origin or an attachment of the model. After this it follows the origin/attachment, rotating and moving to maintain its relative position. Good for long-term emmisive effects like smoke or trails.
attachment_point
The attachment point at which the particle system should spawn, if applicable.

From the point of view of the particle system, you can use several initialisers and operators which will affect how it behaves if it is set to follow an attachment or an origin. The motion of the particles can "follow" the control point by using the Movement Lock to Control Point operator.

You can also use the Position on Model Random initializer to spawn the system dynamically across the model.