Class GpuParticles3D
- Namespace
- Godot
- Assembly
- GodotSharp.dll
3D particle node used to create a variety of particle systems and effects. GpuParticles3D features an emitter that generates some number of particles at a given rate.
Use ProcessMaterial to add a ParticleProcessMaterial to configure particle appearance and behavior. Alternatively, you can add a ShaderMaterial which will be applied to all particles.
[GodotClassName("GPUParticles3D")]
public class GpuParticles3D : GeometryInstance3D, IDisposable
- Inheritance
-
GpuParticles3D
- Implements
- Inherited Members
Constructors
GpuParticles3D()
public GpuParticles3D()
Fields
MaxDrawPasses
Maximum number of draw passes supported.
public const long MaxDrawPasses = 4
Field Value
Properties
Amount
The number of particles to emit in one emission cycle. The effective emission rate is (amount * amount_ratio) / lifetime
particles per second. Higher values will increase GPU requirements, even if not all particles are visible at a given time or if AmountRatio is decreased.
Note: Changing this value will cause the particle system to restart. To avoid this, change AmountRatio instead.
public int Amount { get; set; }
Property Value
AmountRatio
The ratio of particles that should actually be emitted. If set to a value lower than 1.0
, this will set the amount of emitted particles throughout the lifetime to amount * amount_ratio
. Unlike changing Amount, changing AmountRatio while emitting does not affect already-emitted particles and doesn't cause the particle system to restart. AmountRatio can be used to create effects that make the number of emitted particles vary over time.
Note: Reducing the AmountRatio has no performance benefit, since resources need to be allocated and processed for the total Amount of particles regardless of the AmountRatio. If you don't intend to change the number of particles emitted while the particles are emitting, make sure AmountRatio is set to 1
and change Amount to your liking instead.
public float AmountRatio { get; set; }
Property Value
CollisionBaseSize
The base diameter for particle collision in meters. If particles appear to sink into the ground when colliding, increase this value. If particles appear to float when colliding, decrease this value. Only effective if CollisionMode is Rigid or HideOnContact.
Note: Particles always have a spherical collision shape.
public float CollisionBaseSize { get; set; }
Property Value
DrawOrder
Particle draw order. Uses GpuParticles3D.DrawOrderEnum values.
Note: Index is the only option that supports motion vectors for effects like TAA. It is suggested to use this draw order if the particles are opaque to fix ghosting artifacts.
public GpuParticles3D.DrawOrderEnum DrawOrder { get; set; }
Property Value
DrawPass1
Mesh that is drawn for the first draw pass.
public Mesh DrawPass1 { get; set; }
Property Value
DrawPass2
Mesh that is drawn for the second draw pass.
public Mesh DrawPass2 { get; set; }
Property Value
DrawPass3
Mesh that is drawn for the third draw pass.
public Mesh DrawPass3 { get; set; }
Property Value
DrawPass4
Mesh that is drawn for the fourth draw pass.
public Mesh DrawPass4 { get; set; }
Property Value
DrawPasses
The number of draw passes when rendering particles.
public int DrawPasses { get; set; }
Property Value
DrawSkin
public Skin DrawSkin { 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
Time ratio between each emission. If 0
, particles are emitted continuously. If 1
, all particles are emitted simultaneously.
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
InterpToEnd
Causes all the particles in this node to interpolate towards the end of their lifetime.
Note: This only works when used with a ParticleProcessMaterial. It needs to be manually implemented for custom process shaders.
public float InterpToEnd { get; set; }
Property Value
Interpolate
Enables particle interpolation, which makes the particle movement smoother when their FixedFps is lower than the screen refresh rate.
public bool Interpolate { get; set; }
Property Value
Lifetime
The amount of time each particle will exist (in seconds). The effective emission rate is (amount * amount_ratio) / lifetime
particles per second.
public double Lifetime { 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 GpuParticles3D node (and its parents) when it is moved or rotated. If false
, particles use global coordinates; they will not move or rotate along the GpuParticles3D node (and its parents) when it is moved or rotated.
public bool LocalCoords { get; set; }
Property Value
OneShot
If true
, only the number of particles equal to Amount will be emitted.
public bool OneShot { get; set; }
Property Value
Preprocess
Amount of time to preprocess the particles before animation starts. Lets you start the animation some time after particles have started emitting.
public double Preprocess { get; set; }
Property Value
ProcessMaterial
Material for processing particles. Can be a ParticleProcessMaterial or a ShaderMaterial.
public Material ProcessMaterial { get; set; }
Property Value
Randomness
Emission randomness ratio.
public float Randomness { get; set; }
Property Value
SpeedScale
Speed scaling ratio. A value of 0
can be used to pause the particles.
public double SpeedScale { get; set; }
Property Value
SubEmitter
Path to another GpuParticles3D node that will be used as a subemitter (see SubEmitterMode). Subemitters can be used to achieve effects such as fireworks, sparks on collision, bubbles popping into water drops, and more.
Note: When SubEmitter is set, the target GpuParticles3D node will no longer emit particles on its own.
public NodePath SubEmitter { get; set; }
Property Value
TrailEnabled
If true
, enables particle trails using a mesh skinning system. Designed to work with RibbonTrailMesh and TubeTrailMesh.
Note:
UseParticleTrails must also be enabled on the particle mesh's material. Otherwise, setting TrailEnabled to true
will have no effect.
Note: Unlike GpuParticles2D, the number of trail sections and subdivisions is set in the RibbonTrailMesh or the TubeTrailMesh's properties.
public bool TrailEnabled { get; set; }
Property Value
TrailLifetime
The amount of time the particle's trail should represent (in seconds). Only effective if TrailEnabled is true
.
public double TrailLifetime { get; set; }
Property Value
TransformAlign
public GpuParticles3D.TransformAlignEnum TransformAlign { get; set; }
Property Value
VisibilityAabb
The Aabb that determines the node's region which needs to be visible on screen for the particle system to be active. ExtraCullMargin is added on each of the AABB's axes. Particle collisions and attraction will only occur within this area.
Grow the box if particles suddenly appear/disappear when the node enters/exits the screen. The Aabb can be grown via code or with the Particles → Generate AABB editor tool.
Note: VisibilityAabb is overridden by CustomAabb if that property is set to a non-default value.
public Aabb VisibilityAabb { get; set; }
Property Value
Methods
CaptureAabb()
Returns the axis-aligned bounding box that contains all the particles that are active in the current frame.
public Aabb CaptureAabb()
Returns
ConvertFromParticles(Node)
Sets this node's properties to match a given CpuParticles3D node.
public void ConvertFromParticles(Node particles)
Parameters
particles
Node
EmitParticle(Transform3D, Vector3, Color, Color, uint)
Emits a single particle. Whether xform
, velocity
, color
and custom
are applied depends on the value of flags
. See GpuParticles3D.EmitFlags.
public void EmitParticle(Transform3D xform, Vector3 velocity, Color color, Color custom, uint flags)
Parameters
xform
Transform3Dvelocity
Vector3color
Colorcustom
Colorflags
uint
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 emission, clearing existing particles.
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.
Note: Due to the particles being computed on the GPU there might be a delay before the signal gets emitted.
public event Action Finished