参考《粒子系统的关键概念 | Unreal Engine Documentation》以及UE4源代码,尽可能对Cascade粒子系统中的以下概念有更深的了解:
粒子系统(ParticleSystem)粒子发射器(ParticleEmitter)粒子系统模块(ParticleModule)发射器Actor“粒子系统” 是一种资源,可以直接在内容浏览器中被创建: 双击这个资源可以进入Cascade粒子编辑器。
源代码中的定义和注释如下:
/** * A ParticleSystem is a complete particle effect that contains any number of ParticleEmitters. By allowing multiple emitters * in a system, the designer can create elaborate particle effects that are held in a single system. Once created using * Cascade, a ParticleSystem can then be inserted into a level or created in script. */ class UParticleSystem : public UFXSystemAsset一个 “粒子系统” 完整表达了一个粒子特效,包含了任意数目的 “粒子发射器” ,设计师可以用它组合出复杂而精妙的效果并“装进”一个独立的系统中,随后可以放到关卡中或是由脚本创建。
UParticleSystem这个类的继承关系如下:
UObject UFXSystemAsset UParticleSystem UNiagaraSystem一个 “粒子发射器” 发射了一种特定类型的粒子,在一个 “粒子系统” 中可以添加任意数目的 “粒子发射器” 。
UParticleEmitter直接继承自UObject:
class UParticleEmitter : public UObjectUParticleSystem 有发射器列表:
/** Emitters - internal - the array of emitters in the system */ UPROPERTY(instanced) TArray<UParticleEmitter*> Emitters;一个 “粒子模块” 定义了粒子的一种行为,被放到了 “粒子发射器” 中。
直接继承自UObject:
class ENGINE_API UParticleModule : public UObject它有多个具体的种类:
UParticleModule UParticleModuleVelocityBase UParticleModuleVectorFieldBase UParticleModuleTypeDataBase UParticleModuleTrailBase UParticleModuleSubUVBase UParticleModuleSpawnBase UParticleModuleSizeBase UParticleModuleRotationRateBase UParticleModuleRotationBase UParticleModuleRequired UObject UParticleModuleParameterBase UParticleModuleOrientationBase UParticleModuleOrbitBase UParticleModuleMaterialBase UParticleModuleLocationBase UParticleModuleLightBase UParticleModuleLifetimeBase UParticleModuleKillBase UParticleModuleEventBase UParticleModuleColorBase UParticleModuleCollisionBase UParticleModuleCameraBase UParticleModuleBeamBase UParticleModuleAttractorBase UParticleModuleAccelerationBase UParticleModuleAccelerationOverLifetime UParticleModuleAccelerationDragScaleOverLife UParticleModuleAccelerationDrag UParticleModuleAccelerationConstant UParticleModuleAcceleration UParticleModuleAttractorPointGravity UParticleModuleAttractorPoint UParticleModuleAttractorParticle UParticleModuleAttractorLine UParticleModuleBeamTarget UParticleModuleBeamSource UParticleModuleBeamNoise UParticleModuleBeamModifier UParticleModuleCameraOffset UParticleModuleCollisionGPU UParticleModuleCollision UParticleModuleColorScaleOverLife UParticleModuleColorOverLife UParticleModuleColor UParticleModuleColor_Seeded UParticleModuleEventReceiverBase UParticleModuleEventGenerator UParticleModuleEventReceiverSpawn UParticleModuleEventReceiverKillParticles UParticleModuleKillHeight UParticleModuleKillBox UParticleModuleLifetime UParticleModuleLifetime_Seeded UParticleModuleLight UParticleModuleLight_Seeded UParticleModulePivotOffset UParticleModuleSourceMovement UParticleModuleLocationSkelVertSurface UParticleModuleLocationPrimitiveTriangle UParticleModuleLocationPrimitiveBase UParticleModuleLocationEmitterDirect UParticleModuleLocationEmitter UParticleModuleLocationDirect UParticleModuleLocationBoneSocket UParticleModuleLocation UParticleModuleLocation_Seeded UParticleModuleLocationWorldOffset UParticleModuleLocationWorldOffset_Seeded UParticleModuleLocationPrimitiveSphere UParticleModuleLocationPrimitiveCylinder UParticleModuleLocationPrimitiveCylinder_Seeded UParticleModuleLocationPrimitiveSphere_Seeded UParticleModuleMeshMaterial UParticleModuleOrbit UParticleModuleOrientationAxisLock UParticleModuleParameterDynamic UParticleModuleParameterDynamic_Seeded UParticleModuleRotationOverLifetime UParticleModuleRotation UParticleModuleMeshRotation UParticleModuleMeshRotation_Seeded UParticleModuleRotation_Seeded UParticleModuleRotationRateMultiplyLife UParticleModuleRotationRate UParticleModuleMeshRotationRateOverLife UParticleModuleMeshRotationRateMultiplyLife UParticleModuleMeshRotationRate UParticleModuleMeshRotationRate_Seeded UParticleModuleRotationRate_Seeded UParticleModuleSizeScaleBySpeed UParticleModuleSizeScale UParticleModuleSizeMultiplyLife UParticleModuleSize UParticleModuleSize_Seeded UParticleModuleSpawnPerUnit UParticleModuleSpawn UParticleModuleSubUV UParticleModuleSubUVMovie UParticleModuleTrailSource UParticleModuleTypeDataRibbon UParticleModuleTypeDataMesh UParticleModuleTypeDataGpu UParticleModuleTypeDataBeam2 UParticleModuleTypeDataAnimTrail UParticleModuleVectorFieldScaleOverLife UParticleModuleVectorFieldScale UParticleModuleVectorFieldRotationRate UParticleModuleVectorFieldRotation UParticleModuleVectorFieldLocal UParticleModuleVectorFieldGlobal UParticleModuleVelocityOverLifetime UParticleModuleVelocityInheritParent UParticleModuleVelocityCone UParticleModuleVelocity UParticleModuleVelocity_Seeded《粒子系统参考 | Unreal Engine Documentation》中有详细的介绍。
将 “粒子系统” 从内容浏览器拖到关卡里,便可以创建一个 “发射器Actor”: AEmitter直接继承自AActor
class ENGINE_API AEmitter : public AActor它拥有一个UParticleSystemComponent成员
class UParticleSystemComponent* ParticleSystemComponent;而UParticleSystemComponent联系了一个 “粒子系统” 作为“模板”:
class UParticleSystem* Template;总结他们的关系如下
使用1个作为模板 实例到关卡中 拥有多个_ 被多个不同种类的_所定义 发射器Actor 粒子系统 粒子发射器 粒子模块