Table of Contents

Class CpuParticles2D

Namespace
Godot
Assembly
GodotSharp.dll

CPU-based 2D particle node used to create a variety of particle systems and effects.

See also GpuParticles2D, which provides the same functionality with hardware acceleration, but may not run on older devices.

[GodotClassName("CPUParticles2D")]
public class CpuParticles2D : Node2D, IDisposable
Inheritance
CpuParticles2D
Implements
Inherited Members

Constructors

CpuParticles2D()

public CpuParticles2D()

Properties

Amount

Number of particles emitted in one emission cycle.

public int Amount { get; set; }

Property Value

int

AngleCurve

Each particle's rotation will be animated along this Curve.

public Curve AngleCurve { get; set; }

Property Value

Curve

AngleMax

Maximum initial rotation applied to each particle, in degrees.

public float AngleMax { get; set; }

Property Value

float

AngleMin

Minimum equivalent of AngleMax.

public float AngleMin { get; set; }

Property Value

float

AngularVelocityCurve

Each particle's angular velocity will vary along this Curve.

public Curve AngularVelocityCurve { get; set; }

Property Value

Curve

AngularVelocityMax

Maximum initial angular velocity (rotation speed) applied to each particle in degrees per second.

public float AngularVelocityMax { get; set; }

Property Value

float

AngularVelocityMin

Minimum equivalent of AngularVelocityMax.

public float AngularVelocityMin { get; set; }

Property Value

float

AnimOffsetCurve

Each particle's animation offset will vary along this Curve.

public Curve AnimOffsetCurve { get; set; }

Property Value

Curve

AnimOffsetMax

Maximum animation offset that corresponds to frame index in the texture. 0 is the first frame, 1 is the last one. See ParticlesAnimation.

public float AnimOffsetMax { get; set; }

Property Value

float

AnimOffsetMin

Minimum equivalent of AnimOffsetMax.

public float AnimOffsetMin { get; set; }

Property Value

float

AnimSpeedCurve

Each particle's animation speed will vary along this Curve.

public Curve AnimSpeedCurve { get; set; }

Property Value

Curve

AnimSpeedMax

Maximum particle animation speed. Animation speed of 1 means that the particles will make full 0 to 1 offset cycle during lifetime, 2 means 2 cycles etc.

With animation speed greater than 1, remember to enable ParticlesAnimLoop property if you want the animation to repeat.

public float AnimSpeedMax { get; set; }

Property Value

float

AnimSpeedMin

Minimum equivalent of AnimSpeedMax.

public float AnimSpeedMin { get; set; }

Property Value

float

Color

Each particle's initial color. If Texture is defined, it will be multiplied by this color.

public Color Color { get; set; }

Property Value

Color

ColorInitialRamp

Each particle's initial color will vary along this GradientTexture1D (multiplied with Color).

public Gradient ColorInitialRamp { get; set; }

Property Value

Gradient

ColorRamp

Each particle's color will vary along this Gradient (multiplied with Color).

public Gradient ColorRamp { get; set; }

Property Value

Gradient

DampingCurve

Damping will vary along this Curve.

public Curve DampingCurve { get; set; }

Property Value

Curve

DampingMax

The maximum rate at which particles lose velocity. For example value of 100 means that the particle will go from 100 velocity to 0 in 1 second.

public float DampingMax { get; set; }

Property Value

float

DampingMin

Minimum equivalent of DampingMax.

public float DampingMin { get; set; }

Property Value

float

Direction

Unit vector specifying the particles' emission direction.

public Vector2 Direction { get; set; }

Property Value

Vector2

DrawOrder

Particle draw order. Uses CpuParticles2D.DrawOrderEnum values.

public CpuParticles2D.DrawOrderEnum DrawOrder { get; set; }

Property Value

CpuParticles2D.DrawOrderEnum

EmissionColors

Sets the Colors to modulate particles by when using Points or DirectedPoints.

public Color[] EmissionColors { get; set; }

Property Value

Color[]

EmissionNormals

Sets the direction the particles will be emitted in when using DirectedPoints.

public Vector2[] EmissionNormals { get; set; }

Property Value

Vector2[]

EmissionPoints

Sets the initial positions to spawn particles when using Points or DirectedPoints.

public Vector2[] EmissionPoints { get; set; }

Property Value

Vector2[]

EmissionRectExtents

The rectangle's extents if EmissionShape is set to Rectangle.

public Vector2 EmissionRectExtents { get; set; }

Property Value

Vector2

EmissionShape

Particles will be emitted inside this region. See CpuParticles2D.EmissionShapeEnum for possible values.

public CpuParticles2D.EmissionShapeEnum EmissionShape { get; set; }

Property Value

CpuParticles2D.EmissionShapeEnum

EmissionSphereRadius

The sphere's radius if EmissionShape is set to Sphere.

public float EmissionSphereRadius { get; set; }

Property Value

float

Emitting

If true, particles are being emitted. Emitting can be used to start and stop particles from emitting. However, if OneShot is true setting Emitting to true will not restart the emission cycle until after all active particles finish processing. You can use the Finished signal to be notified once all active particles finish processing.

public bool Emitting { get; set; }

Property Value

bool

Explosiveness

How rapidly particles in an emission cycle are emitted. If greater than 0, there will be a gap in emissions before the next cycle begins.

public float Explosiveness { get; set; }

Property Value

float

FixedFps

The particle system's frame rate is fixed to a value. For example, changing the value to 2 will make the particles render at 2 frames per second. Note this does not slow down the simulation of the particle system itself.

public int FixedFps { get; set; }

Property Value

int

FractDelta

If true, results in fractional delta calculation which has a smoother particles display effect.

public bool FractDelta { get; set; }

Property Value

bool

Gravity

Gravity applied to every particle.

public Vector2 Gravity { get; set; }

Property Value

Vector2

HueVariationCurve

Each particle's hue will vary along this Curve.

public Curve HueVariationCurve { get; set; }

Property Value

Curve

HueVariationMax

Maximum initial hue variation applied to each particle. It will shift the particle color's hue.

public float HueVariationMax { get; set; }

Property Value

float

HueVariationMin

Minimum equivalent of HueVariationMax.

public float HueVariationMin { get; set; }

Property Value

float

InitialVelocityMax

Maximum initial velocity magnitude for each particle. Direction comes from Direction and Spread.

public float InitialVelocityMax { get; set; }

Property Value

float

InitialVelocityMin

Minimum equivalent of InitialVelocityMax.

public float InitialVelocityMin { get; set; }

Property Value

float

Lifetime

Amount of time each particle will exist.

public double Lifetime { get; set; }

Property Value

double

LifetimeRandomness

Particle lifetime randomness ratio.

public double LifetimeRandomness { get; set; }

Property Value

double

LinearAccelCurve

Each particle's linear acceleration will vary along this Curve.

public Curve LinearAccelCurve { get; set; }

Property Value

Curve

LinearAccelMax

Maximum linear acceleration applied to each particle in the direction of motion.

public float LinearAccelMax { get; set; }

Property Value

float

LinearAccelMin

Minimum equivalent of LinearAccelMax.

public float LinearAccelMin { get; set; }

Property Value

float

LocalCoords

If true, particles use the parent node's coordinate space (known as local coordinates). This will cause particles to move and rotate along the CpuParticles2D node (and its parents) when it is moved or rotated. If false, particles use global coordinates; they will not move or rotate along the CpuParticles2D node (and its parents) when it is moved or rotated.

public bool LocalCoords { get; set; }

Property Value

bool

OneShot

If true, only one emission cycle occurs. If set true during a cycle, emission will stop at the cycle's end.

public bool OneShot { get; set; }

Property Value

bool

OrbitVelocityCurve

Each particle's orbital velocity will vary along this Curve.

public Curve OrbitVelocityCurve { get; set; }

Property Value

Curve

OrbitVelocityMax

Maximum orbital velocity applied to each particle. Makes the particles circle around origin. Specified in number of full rotations around origin per second.

public float OrbitVelocityMax { get; set; }

Property Value

float

OrbitVelocityMin

Minimum equivalent of OrbitVelocityMax.

public float OrbitVelocityMin { get; set; }

Property Value

float

ParticleFlagAlignY

Align Y axis of particle with the direction of its velocity.

public bool ParticleFlagAlignY { get; set; }

Property Value

bool

Preprocess

Particle system starts as if it had already run for this many seconds.

public double Preprocess { get; set; }

Property Value

double

RadialAccelCurve

Each particle's radial acceleration will vary along this Curve.

public Curve RadialAccelCurve { get; set; }

Property Value

Curve

RadialAccelMax

Maximum radial acceleration applied to each particle. Makes particle accelerate away from the origin or towards it if negative.

public float RadialAccelMax { get; set; }

Property Value

float

RadialAccelMin

Minimum equivalent of RadialAccelMax.

public float RadialAccelMin { get; set; }

Property Value

float

Randomness

Emission lifetime randomness ratio.

public float Randomness { get; set; }

Property Value

float

ScaleAmountCurve

Each particle's scale will vary along this Curve.

public Curve ScaleAmountCurve { get; set; }

Property Value

Curve

ScaleAmountMax

Maximum initial scale applied to each particle.

public float ScaleAmountMax { get; set; }

Property Value

float

ScaleAmountMin

Minimum equivalent of ScaleAmountMax.

public float ScaleAmountMin { get; set; }

Property Value

float

ScaleCurveX

Each particle's horizontal scale will vary along this Curve.

SplitScale must be enabled.

public Curve ScaleCurveX { get; set; }

Property Value

Curve

ScaleCurveY

Each particle's vertical scale will vary along this Curve.

SplitScale must be enabled.

public Curve ScaleCurveY { get; set; }

Property Value

Curve

SpeedScale

Particle system's running speed scaling ratio. A value of 0 can be used to pause the particles.

public double SpeedScale { get; set; }

Property Value

double

SplitScale

If true, the scale curve will be split into x and y components. See ScaleCurveX and ScaleCurveY.

public bool SplitScale { get; set; }

Property Value

bool

Spread

Each particle's initial direction range from +spread to -spread degrees.

public float Spread { get; set; }

Property Value

float

TangentialAccelCurve

Each particle's tangential acceleration will vary along this Curve.

public Curve TangentialAccelCurve { get; set; }

Property Value

Curve

TangentialAccelMax

Maximum tangential acceleration applied to each particle. Tangential acceleration is perpendicular to the particle's velocity giving the particles a swirling motion.

public float TangentialAccelMax { get; set; }

Property Value

float

TangentialAccelMin

Minimum equivalent of TangentialAccelMax.

public float TangentialAccelMin { get; set; }

Property Value

float

Texture

Particle texture. If null, particles will be squares.

public Texture2D Texture { get; set; }

Property Value

Texture2D

Methods

ConvertFromParticles(Node)

Sets this node's properties to match a given GpuParticles2D node with an assigned ParticleProcessMaterial.

public void ConvertFromParticles(Node particles)

Parameters

particles Node

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

Restart()

Restarts the particle emitter.

public void Restart()

Events

Finished

Emitted when all active particles have finished processing. When OneShot is disabled, particles will process continuously, so this is never emitted.

public event Action Finished

Event Type

Action