Particles2D

Inherits: Node2D < CanvasItem < Node < Object

GPU-based 2D particle emitter.

Descripción

2D particle node used to create a variety of particle systems and effects. Particles2D features an emitter that generates some number of particles at a given rate.

Use the process_material property to add a ParticlesMaterial to configure particle appearance and behavior. Alternatively, you can add a ShaderMaterial which will be applied to all particles.

Note: Particles2D only work when using the GLES3 renderer. If using the GLES2 renderer, use CPUParticles2D instead. You can convert Particles2D to CPUParticles2D by selecting the node, clicking the Particles menu at the top of the 2D editor viewport then choosing Convert to CPUParticles2D.

Note: After working on a Particles node, remember to update its visibility_rect by selecting it, clicking the Particles menu at the top of the 2D editor viewport then choose Generate Visibility Rect. Otherwise, particles may suddenly disappear depending on the camera position and angle.

Note: Unlike CPUParticles2D, Particles2D currently ignore the texture region defined in AtlasTextures.

Tutoriales

Propiedades

int

amount

8

DrawOrder

draw_order

0

bool

emitting

true

float

explosiveness

0.0

int

fixed_fps

0

bool

fract_delta

true

float

lifetime

1.0

bool

local_coords

true

Texture

normal_map

bool

one_shot

false

float

preprocess

0.0

Material

process_material

float

randomness

0.0

float

speed_scale

1.0

Texture

texture

Rect2

visibility_rect

Rect2( -100, -100, 200, 200 )

Métodos

Rect2

capture_rect ( ) const

void

restart ( )

Enumeraciones

enum DrawOrder:

  • DRAW_ORDER_INDEX = 0 --- Las partículas se dibujan en el orden en que se emiten.

  • DRAW_ORDER_LIFETIME = 1 --- Las partículas se dibujan en orden según el tiempo de vida restante.

Descripciones de Propiedades

Default

8

Setter

set_amount(value)

Getter

get_amount()

The number of particles emitted in one emission cycle (corresponding to the lifetime).

Note: Changing amount will reset the particle emission, therefore removing all particles that were already emitted before changing amount.


Default

0

Setter

set_draw_order(value)

Getter

get_draw_order()

Orden de dibujo de las partículas. Utiliza los valores de DrawOrder.


Default

true

Setter

set_emitting(value)

Getter

is_emitting()

Si true, se están emitiendo partículas.


Default

0.0

Setter

set_explosiveness_ratio(value)

Getter

get_explosiveness_ratio()

La rapidez con la que se emiten las partículas en un ciclo de emisión. Si es mayor que 0, habrá una espacio de tiempo en las emisiones antes de que comience el siguiente ciclo.


  • int fixed_fps

Default

0

Setter

set_fixed_fps(value)

Getter

get_fixed_fps()

La velocidad de fotogramas del sistema de partículas está fijada a un valor. Por ejemplo, cambiando el valor a 2 hará que las partículas se rendericen a 2 fotogramas por segundo. Ten en cuenta que esto no ralentiza la simulación del sistema de partículas en sí.


Default

true

Setter

set_fractional_delta(value)

Getter

get_fractional_delta()

Si true, resulta en un cálculo delta fraccionario que tiene un efecto de visualización de partículas más suave.


Default

1.0

Setter

set_lifetime(value)

Getter

get_lifetime()

The amount of time each particle will exist (in seconds).


Default

true

Setter

set_use_local_coordinates(value)

Getter

get_use_local_coordinates()

Si true, las partículas usan el espacio de coordenadas del nodo padre. Si false, usan las coordenadas globales.


Setter

set_normal_map(value)

Getter

get_normal_map()

Mapa normal para ser usado por la propiedad texture.

Nota: Godot espera que el mapa normal utilice las coordenadas X+, Y-, y Z+. Ver esta página para una comparación de las coordenadas del mapa normal esperadas por los motores más populares.


Default

false

Setter

set_one_shot(value)

Getter

get_one_shot()

Si true, sólo se produce un ciclo de emisión. Si se establece true durante un ciclo, la emisión se detendrá al final del ciclo.


Default

0.0

Setter

set_pre_process_time(value)

Getter

get_pre_process_time()

El sistema de partículas se inicia como si ya hubiera funcionado durante este número de segundos.


Setter

set_process_material(value)

Getter

get_process_material()

Material para procesar partículas. Puede ser un ParticlesMaterial o un ShaderMaterial.


Default

0.0

Setter

set_randomness_ratio(value)

Getter

get_randomness_ratio()

Proporción de aleatoriedad de la vida útil de las emisiones.


Default

1.0

Setter

set_speed_scale(value)

Getter

get_speed_scale()

El sistema de partículas está funcionando a una velocidad de escalada. Un valor de 0 puede ser usado para pausar las partículas.


Setter

set_texture(value)

Getter

get_texture()

La textura de las partículas. Si null, las partículas serán cuadradas.


Default

Rect2( -100, -100, 200, 200 )

Setter

set_visibility_rect(value)

Getter

get_visibility_rect()

The Rect2 that determines the node's region which needs to be visible on screen for the particle system to be active.

Grow the rect if particles suddenly appear/disappear when the node enters/exits the screen. The Rect2 can be grown via code or with the Particles → Generate Visibility Rect editor tool.

Descripciones de Métodos

  • Rect2 capture_rect ( ) const

Devuelve un rectángulo que contiene las posiciones de todas las partículas existentes.


  • void restart ( )

Reinicia todas las partículas existentes.