[原][粒子特效][spark]调节器modifier

时间:2023-03-09 08:36:56
[原][粒子特效][spark]调节器modifier

深入浅出spark粒子特效连接:https://www.cnblogs.com/lyggqm/p/9956344.html

group添加modifier的方式:

[原][粒子特效][spark]调节器modifier

modifier

[原][粒子特效][spark]调节器modifier

An abstract class that allows to modify the behaviour of a group of particles over time.

调节器是为了给粒子生命周期过程提供外力的功能,给粒子加上物理功能

它有以下几种:

碰撞弹力设置 Collider

附加喷射器 EmitterAttacher

阻力系数 Friction

引力 Gravity

磁石 PointMass

随机力 RandomForce

旋转 Rotator

旋涡 Vortex

销毁区域  Destroyer

方向力区域 LinearForce

障碍物区域  Obstacle

Collider

Creates and registers a new collider.

Collider::create(float elasticity = 1.0f)

设置粒子的碰撞弹性系数

EmitterAttacher

附加喷射器,其实是附加了一个新的粒子group

[原][粒子特效][spark]调节器modifier

需要将另加的这个group和group下面的emitter都传入,有一点要注意。这个group需要手动加入system

Friction

摩擦力,阻力系数

SPK::Friction::create(float value = 0.0f)

阻力范围0~1

Gravity

万向引力,重力

Gravity::create(const Vector3D & value = Vector3D())

重力大小由value的长度决定

PointMass

磁石

[原][粒子特效][spark]调节器modifier

Modifier defining a point with a mass that attracts or repels particles.

在某个位置顶一个吸引或者排斥粒子的磁石

引力的大小是粒子到点质量的距离的平方的函数。

offset 的存在是防止距离为0时,出现无穷大的力

mass 为正数是引力  为负数是排斥力

RandomForce

随机力

[原][粒子特效][spark]调节器modifier

minVector    最小的方向与力

maxVector   最大的方向与力

minPeriod    最小的受力时长

maxPeriod   最大的受力时长

Rotator

Modifier allowing to rotate particle with their rotation speed.

该修改器不是直接控制粒子角度,而是允许控制粒子旋转速度。

For this modifier to work, the PARAM_ANGLE must be enabled (and can be random in addition but not mutable or interpolated) and the PARAM_ROTATION_SPEED must be at least enabled in the model of the group of particles that are modified

注意这个不是单独使用的modifier需要加插值器interpolator,必须启用PARAM_ANGLE(并且可以是随机的,但不是可变的或插值的),并且必须至少在修改的粒子组的模型中启用PARAM_ROTATION_SPEED

Vortex

[原][粒子特效][spark]调节器modifier

A modifier defining a vortex in the universe.

涡旋是围绕中心的旋转流动。 它的中心(涡旋眼)被定义为空间中的一条线

除了它的中心线,涡流由2个速度定义:
•旋转速度,定义涡旋眼周围的旋转速度。      rotationSpeed
•吸引速度,定义了粒子被涡旋眼吸引的速度。    attractionSpeed

ZonedModifier

[原][粒子特效][spark]调节器modifier

与区域有关的调节器

An abstract modifier with a zone attached to it.

Destroyer

A Modifier that destroy particles.

[原][粒子特效][spark]调节器modifier

进出此区域会销毁

LinearForce

A modifier applying a generic linear force on particles.

[原][粒子特效][spark]调节器modifier

进出此区域会给一个方向力

Obstacle

[原][粒子特效][spark]调节器modifier

一个障碍区域

bouncingRatio 反弹力

friction 摩檫力