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
AngleCurve
Each particle's rotation will be animated along this Curve.
public Curve AngleCurve { get; set; }
Property Value
AngleMax
Maximum initial rotation applied to each particle, in degrees.
public float AngleMax { get; set; }
Property Value
AngleMin
Minimum equivalent of AngleMax.
public float AngleMin { get; set; }
Property Value
AngularVelocityCurve
Each particle's angular velocity will vary along this Curve.
public Curve AngularVelocityCurve { get; set; }
Property Value
AngularVelocityMax
Maximum initial angular velocity (rotation speed) applied to each particle in degrees per second.
public float AngularVelocityMax { get; set; }
Property Value
AngularVelocityMin
Minimum equivalent of AngularVelocityMax.
public float AngularVelocityMin { get; set; }
Property Value
AnimOffsetCurve
Each particle's animation offset will vary along this Curve.
public Curve AnimOffsetCurve { get; set; }
Property Value
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
AnimOffsetMin
Minimum equivalent of AnimOffsetMax.
public float AnimOffsetMin { get; set; }
Property Value
AnimSpeedCurve
Each particle's animation speed will vary along this Curve.
public Curve AnimSpeedCurve { get; set; }
Property Value
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
AnimSpeedMin
Minimum equivalent of AnimSpeedMax.
public float AnimSpeedMin { get; set; }
Property Value
Color
Each particle's initial color. If Texture is defined, it will be multiplied by this color.
public Color Color { get; set; }
Property Value
ColorInitialRamp
Each particle's initial color will vary along this GradientTexture1D (multiplied with Color).
public Gradient ColorInitialRamp { get; set; }
Property Value
ColorRamp
public Gradient ColorRamp { get; set; }
Property Value
DampingCurve
Damping will vary along this Curve.
public Curve DampingCurve { get; set; }
Property Value
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
DampingMin
Minimum equivalent of DampingMax.
public float DampingMin { get; set; }
Property Value
Direction
Unit vector specifying the particles' emission direction.
public Vector2 Direction { get; set; }
Property Value
DrawOrder
Particle draw order. Uses CpuParticles2D.DrawOrderEnum values.
public CpuParticles2D.DrawOrderEnum DrawOrder { get; set; }
Property Value
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
EmissionShape
Particles will be emitted inside this region. See CpuParticles2D.EmissionShapeEnum for possible values.
public CpuParticles2D.EmissionShapeEnum EmissionShape { get; set; }
Property Value
EmissionSphereRadius
The sphere's radius if EmissionShape is set to Sphere.
public float EmissionSphereRadius { get; set; }
Property Value
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
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
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
FractDelta
If true
, results in fractional delta calculation which has a smoother particles display effect.
public bool FractDelta { get; set; }
Property Value
Gravity
Gravity applied to every particle.
public Vector2 Gravity { get; set; }
Property Value
HueVariationCurve
Each particle's hue will vary along this Curve.
public Curve HueVariationCurve { get; set; }
Property Value
HueVariationMax
Maximum initial hue variation applied to each particle. It will shift the particle color's hue.
public float HueVariationMax { get; set; }
Property Value
HueVariationMin
Minimum equivalent of HueVariationMax.
public float HueVariationMin { get; set; }
Property Value
InitialVelocityMax
public float InitialVelocityMax { get; set; }
Property Value
InitialVelocityMin
Minimum equivalent of InitialVelocityMax.
public float InitialVelocityMin { get; set; }
Property Value
Lifetime
Amount of time each particle will exist.
public double Lifetime { get; set; }
Property Value
LifetimeRandomness
Particle lifetime randomness ratio.
public double LifetimeRandomness { get; set; }
Property Value
LinearAccelCurve
Each particle's linear acceleration will vary along this Curve.
public Curve LinearAccelCurve { get; set; }
Property Value
LinearAccelMax
Maximum linear acceleration applied to each particle in the direction of motion.
public float LinearAccelMax { get; set; }
Property Value
LinearAccelMin
Minimum equivalent of LinearAccelMax.
public float LinearAccelMin { get; set; }
Property Value
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
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
OrbitVelocityCurve
Each particle's orbital velocity will vary along this Curve.
public Curve OrbitVelocityCurve { get; set; }
Property Value
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
OrbitVelocityMin
Minimum equivalent of OrbitVelocityMax.
public float OrbitVelocityMin { get; set; }
Property Value
ParticleFlagAlignY
Align Y axis of particle with the direction of its velocity.
public bool ParticleFlagAlignY { get; set; }
Property Value
Preprocess
Particle system starts as if it had already run for this many seconds.
public double Preprocess { get; set; }
Property Value
RadialAccelCurve
Each particle's radial acceleration will vary along this Curve.
public Curve RadialAccelCurve { get; set; }
Property Value
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
RadialAccelMin
Minimum equivalent of RadialAccelMax.
public float RadialAccelMin { get; set; }
Property Value
Randomness
Emission lifetime randomness ratio.
public float Randomness { get; set; }
Property Value
ScaleAmountCurve
Each particle's scale will vary along this Curve.
public Curve ScaleAmountCurve { get; set; }
Property Value
ScaleAmountMax
Maximum initial scale applied to each particle.
public float ScaleAmountMax { get; set; }
Property Value
ScaleAmountMin
Minimum equivalent of ScaleAmountMax.
public float ScaleAmountMin { get; set; }
Property Value
ScaleCurveX
Each particle's horizontal scale will vary along this Curve.
SplitScale must be enabled.
public Curve ScaleCurveX { get; set; }
Property Value
ScaleCurveY
Each particle's vertical scale will vary along this Curve.
SplitScale must be enabled.
public Curve ScaleCurveY { get; set; }
Property Value
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
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
Spread
Each particle's initial direction range from +spread
to -spread
degrees.
public float Spread { get; set; }
Property Value
TangentialAccelCurve
Each particle's tangential acceleration will vary along this Curve.
public Curve TangentialAccelCurve { get; set; }
Property Value
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
TangentialAccelMin
Minimum equivalent of TangentialAccelMax.
public float TangentialAccelMin { get; set; }
Property Value
Texture
Particle texture. If null
, particles will be squares.
public Texture2D Texture { get; set; }
Property Value
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
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