Enumerationmigueldeicaza.swiftgodot 0.45.0SwiftGodot
EmitFlags
GPUParticles2D.swift:42enum EmitFlags
Cases
case position
Particle starts at the specified position.
case rotationScale
Particle starts with specified rotation and scale.
case velocity
Particle starts with the specified velocity vector, which defines the emission direction and speed.
case color
Particle starts with specified color.
case custom
Particle starts with specified
CUSTOM
data.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (31) members.
Types
Type members
Instance members
var amount: Int32
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 ifamountRatio
is decreased.var amountRatio: Double
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 toamount * amount_ratio
. Unlike changingamount
, changingamountRatio
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.var collisionBaseSize: Double
Multiplier for particle’s collision radius.
1.0
corresponds to the size of the sprite. 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 ifcollisionMode
isParticleProcessMaterial/CollisionMode/collisionRigid
orParticleProcessMaterial/CollisionMode/collisionHideOnContact
.var drawOrder: GPUParticles2D.DrawOrder
Particle draw order. Uses
DrawOrder
values.var emitting: Bool
If
true
, particles are being emitted.emitting
can be used to start and stop particles from emitting. However, ifoneShot
istrue
settingemitting
totrue
will not restart the emission cycle until after all active particles finish processing. You can use the [signal finished] signal to be notified once all active particles finish processing.var explosiveness: Double
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.var finished: SimpleSignal
Emitted when all active particles have finished processing. When
oneShot
is disabled, particles will process continuously, so this is never emitted.var fixedFps: Int32
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.
var fractDelta: Bool
If
true
, results in fractional delta calculation which has a smoother particles display effect.var interpToEnd: Double
Causes all the particles in this node to interpolate towards the end of their lifetime.
var interpolate: Bool
Enables particle interpolation, which makes the particle movement smoother when their
fixedFps
is lower than the screen refresh rate.var lifetime: Double
The amount of time each particle will exist (in seconds). The effective emission rate is
(amount * amount_ratio) / lifetime
particles per second.var localCoords: Bool
If
true
, particles use the parent node’s coordinate space (known as local coordinates). This will cause particles to move and rotate along theGPUParticles2D
node (and its parents) when it is moved or rotated. Iffalse
, particles use global coordinates; they will not move or rotate along theGPUParticles2D
node (and its parents) when it is moved or rotated.var oneShot: Bool
If
true
, only one emission cycle occurs. If settrue
during a cycle, emission will stop at the cycle’s end.var preprocess: Double
Particle system starts as if it had already run for this many seconds.
var processMaterial: Material?
Material
for processing particles. Can be aParticleProcessMaterial
or aShaderMaterial
.var randomness: Double
Emission lifetime randomness ratio.
var speedScale: Double
Particle system’s running speed scaling ratio. A value of
0
can be used to pause the particles.var subEmitter: NodePath
Path to another
GPUParticles2D
node that will be used as a subemitter (seesubEmitterMode
). Subemitters can be used to achieve effects such as fireworks, sparks on collision, bubbles popping into water drops, and more.var texture: Texture2D?
Particle texture. If
null
, particles will be squares with a size of 1×1 pixels.var trailEnabled: Bool
If
true
, enables particle trails using a mesh skinning system.var trailLifetime: Double
The amount of time the particle’s trail should represent (in seconds). Only effective if
trailEnabled
istrue
.var trailSectionSubdivisions: Int32
The number of subdivisions to use for the particle trail rendering. Higher values can result in smoother trail curves, at the cost of performance due to increased mesh complexity. See also
trailSections
. Only effective iftrailEnabled
istrue
.var trailSections: Int32
The number of sections to use for the particle trail rendering. Higher values can result in smoother trail curves, at the cost of performance due to increased mesh complexity. See also
trailSectionSubdivisions
. Only effective iftrailEnabled
istrue
.var visibilityRect: Rect2
The
Rect2
that determines the node’s region which needs to be visible on screen for the particle system to be active.func captureRect(
) -> Rect2 Returns a rectangle containing the positions of all existing particles.
func convertFromParticles(Node?
) Sets this node’s properties to match a given
CPUParticles2D
node.func emitParticle(xform: Transform2D, velocity: Vector2, color: Color, custom: Color, flags: UInt32
) Emits a single particle. Whether
xform
,velocity
,color
andcustom
are applied depends on the value offlags
. SeeEmitFlags
.func restart(
) Restarts all the existing particles.
Citizens in SwiftGodot
Conformances
protocol CaseIterable
A type that provides a collection of all of its values.
protocol CustomDebugStringConvertible
A type with a customized textual representation suitable for debugging purposes.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol RawRepresentable<RawValue>
A type that can be converted to and from an associated raw value.
Type members
Instance members
var debugDescription: String
A textual representation of this instance, suitable for debugging
Type features
static func != (lhs: Self, rhs: Self
) -> Bool Returns a Boolean value indicating whether two values are not equal.