Documentation
¶
Overview ¶
2D particle node used to create a variety of particle systems and effects. graphics.gd/classdb/GPUParticles2D features an emitter that generates some number of particles at a given rate.
Use the Instance.ProcessMaterial property to add a graphics.gd/classdb/ParticleProcessMaterial to configure particle appearance and behavior. Alternatively, you can add a graphics.gd/classdb/ShaderMaterial which will be applied to all particles.
2D particles can optionally collide with graphics.gd/classdb/LightOccluder2D, but they don't collide with graphics.gd/classdb/PhysicsBody2D nodes.
Index ¶
- type Advanced
- type Any
- type DrawOrder
- type EmitFlags
- type Expanded
- type Extension
- type ID
- type Instance
- func (self Instance) Amount() int
- func (self Instance) AmountRatio() Float.X
- func (self Instance) AsCanvasItem() CanvasItem.Instance
- func (self Instance) AsGPUParticles2D() Instance
- func (self Instance) AsNode() Node.Instance
- func (self Instance) AsNode2D() Node2D.Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) CaptureRect() Rect2.PositionSize
- func (self Instance) CollisionBaseSize() Float.X
- func (self Instance) ConvertFromParticles(particles Node.Instance)
- func (self Instance) DrawOrder() DrawOrder
- func (self Instance) EmitParticle(xform Transform2D.OriginXY, velocity Vector2.XY, color Color.RGBA, ...)
- func (self Instance) Emitting() bool
- func (self Instance) Explosiveness() Float.X
- func (self Instance) FixedFps() int
- func (self Instance) FractDelta() bool
- func (self Instance) ID() ID
- func (self Instance) InterpToEnd() Float.X
- func (self Instance) Interpolate() bool
- func (self Instance) Lifetime() Float.X
- func (self Instance) LocalCoords() bool
- func (self Instance) OnFinished(cb func(), flags ...Signal.Flags)
- func (self Instance) OneShot() bool
- func (self Instance) Preprocess() Float.X
- func (self Instance) ProcessMaterial() Material.Instance
- func (self Instance) Randomness() Float.X
- func (self Instance) RequestParticlesProcess(process_time Float.X)
- func (self Instance) Restart()
- func (self Instance) Seed() int
- func (self Instance) SetAmount(value int)
- func (self Instance) SetAmountRatio(value Float.X)
- func (self Instance) SetCollisionBaseSize(value Float.X)
- func (self Instance) SetDrawOrder(value DrawOrder)
- func (self Instance) SetEmitting(value bool)
- func (self Instance) SetExplosiveness(value Float.X)
- func (self Instance) SetFixedFps(value int)
- func (self Instance) SetFractDelta(value bool)
- func (self Instance) SetInterpToEnd(value Float.X)
- func (self Instance) SetInterpolate(value bool)
- func (self Instance) SetLifetime(value Float.X)
- func (self Instance) SetLocalCoords(value bool)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetOneShot(value bool)
- func (self Instance) SetPreprocess(value Float.X)
- func (self Instance) SetProcessMaterial(value Material.Instance)
- func (self Instance) SetRandomness(value Float.X)
- func (self Instance) SetSeed(value int)
- func (self Instance) SetSpeedScale(value Float.X)
- func (self Instance) SetSubEmitter(value string)
- func (self Instance) SetTexture(value Texture2D.Instance)
- func (self Instance) SetTrailEnabled(value bool)
- func (self Instance) SetTrailLifetime(value Float.X)
- func (self Instance) SetTrailSectionSubdivisions(value int)
- func (self Instance) SetTrailSections(value int)
- func (self Instance) SetUseFixedSeed(value bool)
- func (self Instance) SetVisibilityRect(value Rect2.PositionSize)
- func (self Instance) SpeedScale() Float.X
- func (self Instance) SubEmitter() string
- func (self Instance) Texture() Texture2D.Instance
- func (self Instance) TrailEnabled() bool
- func (self Instance) TrailLifetime() Float.X
- func (self Instance) TrailSectionSubdivisions() int
- func (self Instance) TrailSections() int
- func (self Instance) UseFixedSeed() bool
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VisibilityRect() Rect2.PositionSize
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type DrawOrder ¶
type DrawOrder int //gd:GPUParticles2D.DrawOrder
const ( // Particles are drawn in the order emitted. DrawOrderIndex DrawOrder = 0 // Particles are drawn in order of remaining lifetime. In other words, the particle with the highest lifetime is drawn at the front. DrawOrderLifetime DrawOrder = 1 // Particles are drawn in reverse order of remaining lifetime. In other words, the particle with the lowest lifetime is drawn at the front. DrawOrderReverseLifetime DrawOrder = 2 )
type EmitFlags ¶
type EmitFlags int //gd:GPUParticles2D.EmitFlags
const ( // Particle starts at the specified position. EmitFlagPosition EmitFlags = 1 // Particle starts with specified rotation and scale. EmitFlagRotationScale EmitFlags = 2 // Particle starts with the specified velocity vector, which defines the emission direction and speed. EmitFlagVelocity EmitFlags = 4 // Particle starts with specified color. EmitFlagColor EmitFlags = 8 // Particle starts with specified CUSTOM data. EmitFlagCustom EmitFlags = 16 )
type Expanded ¶
type Expanded [1]gdclass.GPUParticles2D
func (Expanded) Restart ¶
Restarts the particle emission cycle, clearing existing particles. To avoid particles vanishing from the viewport, wait for the Instance.OnFinished signal before calling.
Note: The Instance.OnFinished signal is only emitted by Instance.OneShot emitters.
If 'keep_seed' is true, the current random seed will be preserved. Useful for seeking and playback.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsCanvasItem ¶
func (self *Extension[T]) AsCanvasItem() CanvasItem.Instance
func (*Extension[T]) AsGPUParticles2D ¶
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.GPUParticles2D
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AmountRatio ¶
func (Instance) AsCanvasItem ¶
func (self Instance) AsCanvasItem() CanvasItem.Instance
func (Instance) AsGPUParticles2D ¶
func (Instance) CaptureRect ¶
func (self Instance) CaptureRect() Rect2.PositionSize
Returns a rectangle containing the positions of all existing particles.
Note: When using threaded rendering this method synchronizes the rendering thread. Calling it often may have a negative impact on performance.
func (Instance) CollisionBaseSize ¶
func (Instance) ConvertFromParticles ¶
Sets this node's properties to match a given graphics.gd/classdb/CPUParticles2D node.
func (Instance) EmitParticle ¶
func (self Instance) EmitParticle(xform Transform2D.OriginXY, velocity Vector2.XY, color Color.RGBA, custom Color.RGBA, flags int)
Emits a single particle. Whether 'xform', 'velocity', 'color' and 'custom' are applied depends on the value of 'flags'. See EmitFlags.
The default ParticleProcessMaterial will overwrite 'color' and use the contents of 'custom' as (rotation, age, animation, lifetime).
Note: Instance.EmitParticle is only supported on the Forward+ and Mobile rendering methods, not Compatibility.
func (Instance) Explosiveness ¶
func (Instance) FractDelta ¶
func (Instance) InterpToEnd ¶
func (Instance) Interpolate ¶
func (Instance) LocalCoords ¶
func (Instance) OnFinished ¶
func (Instance) Preprocess ¶
func (Instance) ProcessMaterial ¶
func (Instance) Randomness ¶
func (Instance) RequestParticlesProcess ¶
Requests the particles to process for extra process time during a single frame.
Useful for particle playback, if used in combination with Instance.UseFixedSeed or by calling Instance.Restart with parameter keep_seed set to true.
func (Instance) Restart ¶
func (self Instance) Restart()
Restarts the particle emission cycle, clearing existing particles. To avoid particles vanishing from the viewport, wait for the Instance.OnFinished signal before calling.
Note: The Instance.OnFinished signal is only emitted by Instance.OneShot emitters.
If 'keep_seed' is true, the current random seed will be preserved. Useful for seeking and playback.
func (Instance) SetAmountRatio ¶
func (Instance) SetCollisionBaseSize ¶
func (Instance) SetDrawOrder ¶
func (Instance) SetEmitting ¶
func (Instance) SetExplosiveness ¶
func (Instance) SetFixedFps ¶
func (Instance) SetFractDelta ¶
func (Instance) SetInterpToEnd ¶
func (Instance) SetInterpolate ¶
func (Instance) SetLifetime ¶
func (Instance) SetLocalCoords ¶
func (Instance) SetOneShot ¶
func (Instance) SetPreprocess ¶
func (Instance) SetProcessMaterial ¶
func (Instance) SetRandomness ¶
func (Instance) SetSpeedScale ¶
func (Instance) SetSubEmitter ¶
func (Instance) SetTexture ¶
func (Instance) SetTrailEnabled ¶
func (Instance) SetTrailLifetime ¶
func (Instance) SetTrailSectionSubdivisions ¶
func (Instance) SetTrailSections ¶
func (Instance) SetUseFixedSeed ¶
func (Instance) SetVisibilityRect ¶
func (self Instance) SetVisibilityRect(value Rect2.PositionSize)
func (Instance) SpeedScale ¶
func (Instance) SubEmitter ¶
func (Instance) TrailEnabled ¶
func (Instance) TrailLifetime ¶
func (Instance) TrailSectionSubdivisions ¶
func (Instance) TrailSections ¶
func (Instance) UseFixedSeed ¶
func (Instance) VisibilityRect ¶
func (self Instance) VisibilityRect() Rect2.PositionSize