跳到主要内容

CPUParticles

继承

GeometryInstance

简要描述

基于CPU的3D粒子发射器。

描述

基于CPU的3D粒子节点,用于创建各种粒子系统和效果。

另请参见Particles,它提供与硬件加速相同的功能,但可能无法在较旧的设备上运行。

成员

类型属性名默认值
intamount8
floatangle0.0
Curveangle_curve
floatangle_random0.0
floatangular_velocity0.0
Curveangular_velocity_curve
floatangular_velocity_random0.0
floatanim_offset0.0
Curveanim_offset_curve
floatanim_offset_random0.0
floatanim_speed0.0
Curveanim_speed_curve
floatanim_speed_random0.0
ColorcolorColor( 1, 1, 1, 1 )
Gradientcolor_ramp
floatdamping0.0
Curvedamping_curve
floatdamping_random0.0
Vector3directionVector3( 1, 0, 0 )
intdraw_order0
Vector3emission_box_extents
PoolColorArrayemission_colorsPoolColorArray( )
PoolVector3Arrayemission_normals
PoolVector3Arrayemission_pointsPoolVector3Array( )
intemission_shape0
floatemission_sphere_radius
boolemittingtrue
floatexplosiveness0.0
intfixed_fps0
boolflag_align_yfalse
boolflag_disable_zfalse
boolflag_rotate_yfalse
floatflatness0.0
boolfract_deltatrue
Vector3gravityVector3( 0, -9.8, 0 )
floathue_variation0.0
Curvehue_variation_curve
floathue_variation_random0.0
floatinitial_velocity0.0
floatinitial_velocity_random0.0
floatlifetime1.0
floatlifetime_randomness0.0
floatlinear_accel0.0
Curvelinear_accel_curve
floatlinear_accel_random0.0
boollocal_coordstrue
Meshmesh
boolone_shotfalse
floatorbit_velocity
Curveorbit_velocity_curve
floatorbit_velocity_random
floatpreprocess0.0
floatradial_accel0.0
Curveradial_accel_curve
floatradial_accel_random0.0
floatrandomness0.0
floatscale_amount1.0
Curvescale_amount_curve
floatscale_amount_random0.0
floatspeed_scale1.0
floatspread45.0
floattangential_accel0.0
Curvetangential_accel_curve
floattangential_accel_random0.0

方法

返回值类型方法名称
voidconvert_from_particles(particles: Node)
floatget_param(param: int) const
Curveget_param_curve(param: int) const
floatget_param_randomness(param: int) const
boolget_particle_flag(flag: int) const
voidrestart()
voidset_param(param: int, value: float)
voidset_param_curve(param: int, curve: Curve)
voidset_param_randomness(param: int, randomness: float)
voidset_particle_flag(flag: int, enable: bool)

枚举

enum DrawOrder:

  • **DRAW_ORDER_INDEX = 0**

粒子按发射顺序绘制。

  • **DRAW_ORDER_LIFETIME = 1**

按照剩余寿命的顺序绘制粒子。

  • **DRAW_ORDER_VIEW_DEPTH = 2**

粒子按深度顺序绘制。


enum Parameter:

  • **PARAM_INITIAL_LINEAR_VELOCITY = 0**

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

  • **PARAM_ANGULAR_VELOCITY = 1**

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

  • **PARAM_ORBIT_VELOCITY = 2**

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

  • **PARAM_LINEAR_ACCEL = 3**

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

  • **PARAM_RADIAL_ACCEL = 4**

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

  • **PARAM_TANGENTIAL_ACCEL = 5**

set_paramset_param_randomnessset_param_curve一起使用以设置切向加速度属性。

  • **PARAM_DAMPING = 6**

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

  • **PARAM_ANGLE = 7**

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

  • **PARAM_SCALE = 8**

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

  • **PARAM_HUE_VARIATION = 9**

set_paramset_param_randomnessset_param_curve一起使用来设置色调变化属性。

  • **PARAM_ANIM_SPEED = 10**

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

  • **PARAM_ANIM_OFFSET = 11**

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

  • **PARAM_MAX = 12**

表示Parameter枚举的个数。


enum Flags:

  • **FLAG_ALIGN_Y_TO_VELOCITY = 0**

set_particle_flag一起使用来设置flag_align_y

  • **FLAG_ROTATE_Y = 1**

set_particle_flag一起使用来设置flag_rotate_y

  • **FLAG_DISABLE_Z = 2**

set_particle_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**

粒子将在emission_points中随机选择的位置发射。粒子颜色将通过emission_colors进行调制。

  • **EMISSION_SHAPE_DIRECTED_POINTS = 4**

粒子将在emission_points中随机选择的位置发射。粒子的速度和旋转将基于emission_normals进行设置。粒子颜色将通过emission_colors进行调节。

  • **EMISSION_SHAPE_MAX = 5**

表示EmissionShape枚举的个数。


常量

成员说明

  • int amount
Default8
setterset_amount(value)
getterget_amount
  • float angle
Default0.0
setterset_param(value)
getterget_param
  • Curve angle_curve
setterset_param_curve(value)
getterget_param_curve
  • float angle_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float angular_velocity
Default0.0
setterset_param(value)
getterget_param
  • Curve angular_velocity_curve
setterset_param_curve(value)
getterget_param_curve
  • float angular_velocity_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float anim_offset
Default0.0
setterset_param(value)
getterget_param
  • Curve anim_offset_curve
setterset_param_curve(value)
getterget_param_curve
  • float anim_offset_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float anim_speed
Default0.0
setterset_param(value)
getterget_param
  • Curve anim_speed_curve
setterset_param_curve(value)
getterget_param_curve
  • 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
  • Gradient color_ramp
setterset_color_ramp(value)
getterget_color_ramp
  • float damping
Default0.0
setterset_param(value)
getterget_param
  • Curve damping_curve
setterset_param_curve(value)
getterget_param_curve
  • float damping_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • Vector3 direction
DefaultVector3( 1, 0, 0 )
setterset_direction(value)
getterget_direction
  • int draw_order
Default0
setterset_draw_order(value)
getterget_draw_order
  • Vector3 emission_box_extents
setterset_emission_box_extents(value)
getterget_emission_box_extents
  • PoolColorArray emission_colors
DefaultPoolColorArray( )
setterset_emission_colors(value)
getterget_emission_colors
  • PoolVector3Array emission_normals
setterset_emission_normals(value)
getterget_emission_normals
  • PoolVector3Array emission_points
DefaultPoolVector3Array( )
setterset_emission_points(value)
getterget_emission_points
  • 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 emitting
Defaulttrue
setterset_emitting(value)
getteris_emitting
  • float explosiveness
Default0.0
setterset_explosiveness_ratio(value)
getterget_explosiveness_ratio
  • int fixed_fps
Default0
setterset_fixed_fps(value)
getterget_fixed_fps
  • bool flag_align_y
Defaultfalse
setterset_particle_flag(value)
getterget_particle_flag
  • bool flag_disable_z
Defaultfalse
setterset_particle_flag(value)
getterget_particle_flag
  • bool flag_rotate_y
Defaultfalse
setterset_particle_flag(value)
getterget_particle_flag
  • float flatness
Default0.0
setterset_flatness(value)
getterget_flatness
  • bool fract_delta
Defaulttrue
setterset_fractional_delta(value)
getterget_fractional_delta
  • Vector3 gravity
DefaultVector3( 0, -9.8, 0 )
setterset_gravity(value)
getterget_gravity
  • float hue_variation
Default0.0
setterset_param(value)
getterget_param
  • Curve hue_variation_curve
setterset_param_curve(value)
getterget_param_curve
  • 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
Default1.0
setterset_lifetime(value)
getterget_lifetime
  • float lifetime_randomness
Default0.0
setterset_lifetime_randomness(value)
getterget_lifetime_randomness
  • float linear_accel
Default0.0
setterset_param(value)
getterget_param
  • Curve linear_accel_curve
setterset_param_curve(value)
getterget_param_curve
  • float linear_accel_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • bool local_coords
Defaulttrue
setterset_use_local_coordinates(value)
getterget_use_local_coordinates
  • Mesh mesh
setterset_mesh(value)
getterget_mesh
  • bool one_shot
Defaultfalse
setterset_one_shot(value)
getterget_one_shot
  • float orbit_velocity
setterset_param(value)
getterget_param
  • Curve orbit_velocity_curve
setterset_param_curve(value)
getterget_param_curve
  • float orbit_velocity_random
setterset_param_randomness(value)
getterget_param_randomness
  • float preprocess
Default0.0
setterset_pre_process_time(value)
getterget_pre_process_time
  • float radial_accel
Default0.0
setterset_param(value)
getterget_param
  • Curve radial_accel_curve
setterset_param_curve(value)
getterget_param_curve
  • float radial_accel_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float randomness
Default0.0
setterset_randomness_ratio(value)
getterget_randomness_ratio
  • float scale_amount
Default1.0
setterset_param(value)
getterget_param
  • Curve scale_amount_curve
setterset_param_curve(value)
getterget_param_curve
  • float scale_amount_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness
  • float speed_scale
Default1.0
setterset_speed_scale(value)
getterget_speed_scale
  • float spread
Default45.0
setterset_spread(value)
getterget_spread
  • float tangential_accel
Default0.0
setterset_param(value)
getterget_param
  • Curve tangential_accel_curve
setterset_param_curve(value)
getterget_param_curve
  • float tangential_accel_random
Default0.0
setterset_param_randomness(value)
getterget_param_randomness

方法说明

  • convert_from_particles convert_from_particles(particles: Node)

设置此节点的属性,以使给定的Particles节点与分配的ParticlesMaterial匹配。


  • get_param get_param(param: int) const

返回由Parameter指定的参数的基值。


  • get_param_curve get_param_curve(param: int) const

返回由Parameter指定的参数的Curve


  • get_param_randomness get_param_randomness(param: int) const

返回由Parameter指定的参数的随机性因子。


  • get_particle_flag get_particle_flag(flag: int) const

返回给定标志的启用状态(有关选项,请参见Flags)。


  • restart restart()

重新启动粒子发射器。


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

设置Parameter指定的参数的基值。


  • set_param_curve set_param_curve(param: int, curve: Curve)

设置Parameter指定的参数的Curve


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

设置Parameter指定的参数的随机性因子。


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

启用或禁用给定标志(有关选项,请参见Flags)。