Struct Particle ​
Namespace: ValveResourceFormat.Particles
Assembly: ValveResourceFormat.dll
Represents a single particle instance with all its runtime properties.
public struct ParticleProperties ​
Age ​
Gets or sets the current age of the particle in seconds.
public float Age { readonly get; set; }Property Value ​
Alpha ​
Gets or sets the alpha (opacity) of the particle, in the range [0, 1].
public float Alpha { readonly get; set; }Property Value ​
AlphaAlternate ​
Gets or sets an alternate alpha value used by some operators and renderers.
public float AlphaAlternate { readonly get; set; }Property Value ​
AlphaWindowThreshold ​
Gets or sets the alpha window threshold scratch value.
public float AlphaWindowThreshold { readonly get; set; }Property Value ​
BoxAngles ​
Gets or sets the orientation of the particle's own bounding box.
public Vector3 BoxAngles { readonly get; set; }Property Value ​
BoxFlags ​
Gets or sets the flags describing how the particle's own bounding box is used.
public float BoxFlags { readonly get; set; }Property Value ​
BoxMaxs ​
Gets or sets the maximum corner of the particle's own bounding box.
public Vector3 BoxMaxs { readonly get; set; }Property Value ​
BoxMins ​
Gets or sets the minimum corner of the particle's own bounding box.
public Vector3 BoxMins { readonly get; set; }Property Value ​
Color ​
Gets or sets the RGB color of the particle, with each component in the range [0, 1].
public Vector3 Color { readonly get; set; }Property Value ​
CreationTime ​
Gets or sets the system time at which this particle was created.
public float CreationTime { readonly get; set; }Property Value ​
Default ​
Gets a reference to the shared default particle instance.
public static ref Particle Default { get; }Property Value ​
ForceAccumulator ​
Gets or sets the acceleration accumulated by force generators this frame; consumed and cleared by .
public Vector3 ForceAccumulator { readonly get; set; }Property Value ​
ForceScale ​
Gets or sets the scale factor applied to forces acting on this particle. 1 = full force, 0 = immovable (pinned). Used by movement/force operators to mask or weight forces per particle.
public float ForceScale { readonly get; set; }Property Value ​
HitboxOffsetPosition ​
Gets or sets the hitbox offset position attribute. The sequential path initializers store (path parameter, segment start control point, segment end control point) here when saving the path offset.
public Vector3 HitboxOffsetPosition { readonly get; set; }Property Value ​
Index ​
Gets or sets the index of this particle within its collection's arrays.
public int Index { readonly get; set; }Property Value ​
Lifetime ​
Gets or sets the total lifetime of the particle in seconds.
public float Lifetime { readonly get; set; }Property Value ​
ManualAnimationFrame ​
Gets or sets the manually selected animation frame index.
public int ManualAnimationFrame { readonly get; set; }Property Value ​
MarkedAsKilled ​
Gets or sets a value indicating whether this particle has been marked for removal.
public bool MarkedAsKilled { readonly get; set; }Property Value ​
Normal ​
Gets or sets the particle's normal, the engine's own attribute rather than anything derived from . A zero write is ignored, and the value is stored as given: the normal-aligned quad basis leaves its axes un-normalized, so a longer normal widens the card.
public Vector3 Normal { readonly get; set; }Property Value ​
NormalizedAge ​
Gets the particle's age as a fraction of its lifetime. May exceed 1 if the particle outlives its lifetime.
public readonly float NormalizedAge { get; }Property Value ​
ParentParticleId ​
Gets or sets the of the parent particle this particle was created from, or -1 when it has no parent. Unlike this survives the parent collection compacting around dead particles.
public int ParentParticleId { readonly get; set; }Property Value ​
ParentParticleIndex ​
Gets or sets the index of the particle's parent particle in a parent system.
public int ParentParticleIndex { readonly get; set; }Property Value ​
ParticleId ​
Gets or sets the particle's identity for deterministic randomness: its
displaced by the owning system's. Every random draw that must stayconstant for a particle over its life is indexed from this, and the seed is what makes two instances of one effect draw differently. Never use it to order particles: the seed makes it an arbitrary large number, not a position.
public int ParticleId { readonly get; set; }Property Value ​
Remarks ​
This is the engine's particle id attribute, the one PF_TYPE_PARTICLE_ID reads, not its m_nUniqueParticleId counter, which is
Position ​
Gets or sets the current world-space position of the particle.
public Vector3 Position { readonly get; set; }Property Value ​
PositionPrevious ​
Gets or sets the world-space position from the previous frame, used for velocity computation.
public Vector3 PositionPrevious { readonly get; set; }Property Value ​
Radius ​
Gets or sets the radius of the particle. The engine seeds this attribute with 5.
public float Radius { readonly get; set; }Property Value ​
RopeSegmentData ​
Gets or sets the per-segment payload carried alongside . Three components, of which the engine's debug overlay prints X and Z as a segment position and count, and PF_TYPE_PARTICLE_ROPE_SEGMENT_NORMALIZED reads Y.
public Vector3 RopeSegmentData { readonly get; set; }Property Value ​
RopeSegmentId ​
Gets or sets the identifier of the rope segment this particle belongs to.
public int RopeSegmentId { readonly get; set; }Property Value ​
Rotation ​
Gets or sets (Yaw, Pitch, Roll) Euler angles in radians.
public Vector3 Rotation { readonly get; set; }Property Value ​
RotationSpeed ​
Gets or sets (Yaw, Pitch, Roll) Euler angles rotation speed.
public Vector3 RotationSpeed { readonly get; set; }Property Value ​
ScratchFloat0 ​
Gets or sets the first general-purpose scratch float.
public float ScratchFloat0 { readonly get; set; }Property Value ​
ScratchFloat1 ​
Gets or sets the second general-purpose scratch float.
public float ScratchFloat1 { readonly get; set; }Property Value ​
ScratchFloat2 ​
Gets or sets the third general-purpose scratch float.
public float ScratchFloat2 { readonly get; set; }Property Value ​
ScratchVector ​
Gets or sets a general-purpose scratch vector.
public Vector3 ScratchVector { readonly get; set; }Property Value ​
ScratchVector2 ​
Gets or sets a second general-purpose scratch vector.
public Vector3 ScratchVector2 { readonly get; set; }Property Value ​
SecondSequenceNumber ​
Gets or sets the second sprite sheet sequence, which the engine's spritecard can sample alongside . Authored as m_nConstantSequenceNumber1, so the engine's suffix is 1 where this is the second. No renderer reads it yet.
public int SecondSequenceNumber { readonly get; set; }Property Value ​
SequenceNumber ​
Gets or sets which of the sprite sheet's animation sequences this particle plays. One sheet can carry several separate animations, and the renderers index into them with this.
public int SequenceNumber { readonly get; set; }Property Value ​
Speed ​
Gets or sets the scalar speed (magnitude) of the particle; setting it rescales the velocity to the new length while preserving its direction.
public float Speed { readonly get; set; }Property Value ​
TrailLength ​
Gets or sets the trail length multiplier for trail-based renderers. The engine seeds this attribute with 0.1.
public float TrailLength { readonly get; set; }Property Value ​
UniqueParticleId ​
Gets or sets where this particle sits in the emission order: the count of particles the system spawned before it, from 0 over the system's lifetime. Use it to address a particle by its place in the sequence, which is what grid and control point placement, count remaps, sound ordering, cable chain order and snapshot row mapping all want. Never index the random table with it: consecutive particles would read consecutive slots.
public int UniqueParticleId { readonly get; set; }Property Value ​
Remarks ​
The engine calls this m_nUniqueParticleId. Despite the name it is a plain counter, and it is not the engine's particle id attribute, which is .
UserEventStates ​
Gets or sets the bit field of user events currently raised on this particle.
public int UserEventStates { readonly get; set; }Property Value ​
Velocity ​
Gets or sets the current velocity of the particle.
public Vector3 Velocity { readonly get; set; }Property Value ​
Methods ​
GetRotationMatrix() ​
Returns a rotation matrix derived from the particle's Euler angles.
public readonly Matrix4x4 GetRotationMatrix()Returns ​
GetTransformationMatrix(float) ​
Returns a combined scale-translation matrix for this particle.
public readonly Matrix4x4 GetTransformationMatrix(float radiusScale = 1)Parameters ​
radiusScale float
Optional additional scale factor applied to the radius.
Returns ​
Kill() ​
Marks this particle for removal at the end of the current frame.
public void Kill()
