跳到主要内容

ParticlesMaterial

继承

Material

简要描述

ParticlesParticles2D节点的粒子属性。

描述

粒子材质定义了粒子的特性和行为。

该材料的某些属性在发射时会应用于每个粒子,而其他材质可以应用CurveTexture来在粒子的整个生命周期内改变其值。

当将随机率应用于属性时,它会按随机量缩放该属性。

成员

类型属性名默认值
floatangle0.0
Textureangle_curve
floatangle_random0.0
floatangular_velocity0.0
Textureangular_velocity_curve
floatangular_velocity_random0.0
floatanim_offset0.0
Textureanim_offset_curve
floatanim_offset_random0.0
floatanim_speed0.0
Textureanim_speed_curve
floatanim_speed_random0.0
ColorcolorColor( 1, 1, 1, 1 )
Texturecolor_ramp
floatdamping0.0
Texturedamping_curve
floatdamping_random0.0
Vector3directionVector3( 1, 0, 0 )
Vector3emission_box_extents
Textureemission_color_texture
Textureemission_normal_texture
intemission_point_count
Textureemission_point_texture
intemission_shape0
floatemission_sphere_radius
boolflag_align_yfalse
boolflag_disable_zfalse
boolflag_rotate_yfalse
floatflatness0.0
Vector3gravityVector3( 0, -9.8, 0 )
floathue_variation0.0
Texturehue_variation_curve
floathue_variation_random0.0
floatinitial_velocity0.0
floatinitial_velocity_random0.0
floatlifetime_randomness0.0
floatlinear_accel0.0
Texturelinear_accel_curve
floatlinear_accel_random0.0
floatorbit_velocity
Textureorbit_velocity_curve
floatorbit_velocity_random
floatradial_accel0.0
Textureradial_accel_curve
floatradial_accel_random0.0
floatscale1.0
Texturescale_curve
floatscale_random0.0
floatspread45.0
floattangential_accel0.0
Texturetangential_accel_curve
floattangential_accel_random0.0
GradientTexturetrail_color_modifier
inttrail_divisor1
CurveTexturetrail_size_modifier

方法

返回值类型方法名称
boolget_flag(flag: int) const
floatget_param(param: int) const
floatget_param_randomness(param: int) const
Textureget_param_texture(param: int) const
voidset_flag(flag: int, enable: bool)
voidset_param(param: int, value: float)
voidset_param_randomness(param: int, randomness: float)
voidset_param_texture(param: int, texture: Texture)

枚举

enum Parameter:

  • **PARAM_INITIAL_LINEAR_VELOCITY = 0**

set_paramset_param_randomnessset_param_texture一起使用以设置初始速度属性。

  • **PARAM_ANGULAR_VELOCITY = 1**

set_paramset_param_randomnessset_param_texture一起使用以设置角速度属性。

  • **PARAM_ORBIT_VELOCITY = 2**

set_paramset_param_randomnessset_param_texture一起使用来设置轨道速度属性。

  • **PARAM_LINEAR_ACCEL = 3**

set_paramset_param_randomnessset_param_texture一起使用以设置线性加速度属性。

  • **PARAM_RADIAL_ACCEL = 4**

set_paramset_param_randomnessset_param_texture一起使用以设置径向加速度属性。

  • **PARAM_TANGENTIAL_ACCEL = 5**

set_paramset_param_randomnessset_param_texture一起使用可设置切向加速度属性。

  • **PARAM_DAMPING = 6**

set_paramset_param_randomnessset_param_texture一起使用以设置阻尼属性。

  • **PARAM_ANGLE = 7**

set_paramset_param_randomnessset_param_texture一起使用以设置角度属性。

  • **PARAM_SCALE = 8**

set_paramset_param_randomnessset_param_texture一起使用以设置比例属性。

  • **PARAM_HUE_VARIATION = 9**

set_paramset_param_randomnessset_param_texture一起使用以设置色调变化属性。

  • **PARAM_ANIM_SPEED = 10**

set_paramset_param_randomnessset_param_texture一起使用以设置动画速度属性。

  • **PARAM_ANIM_OFFSET = 11**

set_paramset_param_randomnessset_param_texture一起使用以设置动画偏移属性。

  • **PARAM_MAX = 12**

表示Parameter枚举的大小。


enum Flags:

  • **FLAG_ALIGN_Y_TO_VELOCITY = 0**

set_flag一起使用来设置flag_align_y

  • **FLAG_ROTATE_Y = 1**

set_flag一起使用来设置flag_rotate_y

  • **FLAG_DISABLE_Z = 2**

set_flag一起使用来设置flag_disable_z

  • **FLAG_MAX = 3**

表示Flags枚举的大小。


enum EmissionShape:

  • **EMISSION_SHAPE_POINT = 0**

所有粒子将从一个点发射。

  • **EMISSION_SHAPE_SPHERE = 1**

粒子将在球体的体积中发射。

  • **EMISSION_SHAPE_BOX = 2**

粒子将在盒子的体积内发射。

  • **EMISSION_SHAPE_POINTS = 3**

粒子将在通过对membermission_point_texture(#membermission_point_texture)上的随机点进行采样而确定的位置处发射。粒子颜色将通过membermission_color_texture(#membermission_color_texture)进行调制。

  • **EMISSION_SHAPE_DIRECTED_POINTS = 4**

粒子将在通过对membermission_point_texture(#membermission_point_texture)上的随机点进行采样而确定的位置处发射。粒子的速度和旋转将基于membermission_normal_texture进行设置。 粒子颜色将通过membermission_color_texture(#membermission_color_texture)进行调制。

  • **EMISSION_SHAPE_MAX = 5**

表示EmissionShape枚举的大小。


常量

成员说明

  • float angle
Default0.0
setterset_param(value)
getterget_param
  • Texture angle_curve
setterset_param_texture(value)
getterget_param_texture
  • float angle_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float angular_velocity
Default0.0
setterset_param(value)
getterget_param
  • Texture angular_velocity_curve
setterset_param_texture(value)
getterget_param_texture
  • float angular_velocity_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float anim_offset
Default0.0
setterset_param(value)
getterget_param
  • Texture anim_offset_curve
setterset_param_texture(value)
getterget_param_texture
  • float anim_offset_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float anim_speed
Default0.0
setterset_param(value)
getterget_param
  • Texture anim_speed_curve
setterset_param_texture(value)
getterget_param_texture
  • float anim_speed_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • Color color
DefaultColor( 1, 1, 1, 1 )
setterset_color(value)
getterget_color
  • Texture color_ramp
setterset_color_ramp(value)
getterget_color_ramp
  • float damping
Default0.0
setterset_param(value)
getterget_param
  • Texture damping_curve
setterset_param_texture(value)
getterget_param_texture
  • float damping_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • Vector3 direction
DefaultVector3( 1, 0, 0 )
setterset_direction(value)
getterget_direction
  • Vector3 emission_box_extents
setterset_emission_box_extents(value)
getterget_emission_box_extents
  • Texture emission_color_texture
setterset_emission_color_texture(value)
getterget_emission_color_texture
  • Texture emission_normal_texture
setterset_emission_normal_texture(value)
getterget_emission_normal_texture
  • int emission_point_count
setterset_emission_point_count(value)
getterget_emission_point_count
  • Texture emission_point_texture
setterset_emission_point_texture(value)
getterget_emission_point_texture
  • int emission_shape
Default0
setterset_emission_shape(value)
getterget_emission_shape
  • float emission_sphere_radius
setterset_emission_sphere_radius(value)
getterget_emission_sphere_radius
  • bool flag_align_y
Defaultfalse
setterset_flag(value)
getterget_flag
  • bool flag_disable_z
Defaultfalse
setterset_flag(value)
getterget_flag
  • bool flag_rotate_y
Defaultfalse
setterset_flag(value)
getterget_flag
  • float flatness
Default0.0
setterset_flatness(value)
getterget_flatness
  • Vector3 gravity
DefaultVector3( 0, -9.8, 0 )
setterset_gravity(value)
getterget_gravity
  • float hue_variation
Default0.0
setterset_param(value)
getterget_param
  • Texture hue_variation_curve
setterset_param_texture(value)
getterget_param_texture
  • float hue_variation_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float initial_velocity
Default0.0
setterset_param(value)
getterget_param
  • float initial_velocity_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float lifetime_randomness
Default0.0
setterset_lifetime_randomness(value)
getterget_lifetime_randomness
  • float linear_accel
Default0.0
setterset_param(value)
getterget_param
  • Texture linear_accel_curve
setterset_param_texture(value)
getterget_param_texture
  • float linear_accel_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float orbit_velocity
setterset_param(value)
getterget_param
  • Texture orbit_velocity_curve
setterset_param_texture(value)
getterget_param_texture
  • float orbit_velocity_random
setterset_param_randomness(value)
getterget_param_randomness
  • float radial_accel
Default0.0
setterset_param(value)
getterget_param
  • Texture radial_accel_curve
setterset_param_texture(value)
getterget_param_texture
  • float radial_accel_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float scale
Default1.0
setterset_param(value)
getterget_param
  • Texture scale_curve
setterset_param_texture(value)
getterget_param_texture
  • float scale_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float spread
Default45.0
setterset_spread(value)
getterget_spread
  • float tangential_accel
Default0.0
setterset_param(value)
getterget_param
  • Texture tangential_accel_curve
setterset_param_texture(value)
getterget_param_texture
  • float tangential_accel_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • GradientTexture trail_color_modifier
setterset_trail_color_modifier(value)
getterget_trail_color_modifier
  • int trail_divisor
Default1
setterset_trail_divisor(value)
getterget_trail_divisor
  • CurveTexture trail_size_modifier
setterset_trail_size_modifier(value)
getterget_trail_size_modifier

方法说明

  • get_flag get_flag(flag: int) const

如果启用了指定的标志,则返回true


  • get_param get_param(param: int) const

返回指定参数的值。


  • get_param_randomness get_param_randomness(param: int) const

返回与指定参数关联的随机率。


  • get_param_texture get_param_texture(param: int) const

返回指定参数使用的Texture


  • set_flag set_flag(flag: int, enable: bool)

如果为true,则启用指定的标志。有关选项,请参见Flags


  • set_param set_param(param: int, value: float)

设置指定的Parameter


  • set_param_randomness set_param_randomness(param: int, randomness: float)

设置指定的Parameter的随机率。


  • set_param_texture set_param_texture(param: int, texture: Texture)

为指定的Parameter设置Texture