Particles on models

From Valve Developer Community
Revision as of 22:40, 3 July 2008 by Mdurand (talk | contribs)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Particle Effects can be attached to models by adding a "particles" section the model's .qc file. Particles specified in this manner will be created whenever an entity switches to using the model. This usually occurs when an entity is spawned for the first time, but can also happen when an entity dynamically switches models.

Within the .qc's $keyvalues section, the format is as follows:

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

   <more effects>
}

The <particle effect name> must match the name of one of the .pcf files in your game/particles directory.

The <attachment type> must match one of the valid attachment types. These are:

  • start_at_origin: The particle effect is created at the origin of the entity it's attached to. The effect doesn't move.
  • start_at_attachment: The particle effect is created on an attachment point on the entity it's attached to. The effect doesn't move.
  • follow_origin: The particle effect is created at the origin of the entity it's attached to. The effect is updated to move with the entity's origin.
  • follow_attachment: The particle effect is created on an attachment point on the entity it's attached to. The effect is updated to move with the attachment point.

The <attachment_point> must match the name of an attachment point in the model. This field is only needed if the <attachment type> is one that uses an attachment point.