keywords: [UE4]Particle Related

Keywords:Warmup Time, no delay, at once, Particle System, 特效, 粒子

Emitter Editor

Show particle no delay when emitter spawned

默认播放特效时,会有一秒的延迟,如果想让粒子生成后立即播放,需要进行以下设置:
1,点击例子系统编辑界面最右侧的黑色空闲区域

2,然后在Detail面板中找到Warmup Time参数,修改为1。默认为0

新版本中Warmup Time设置为1并不能生效,需要设为0.1

How to particle’s world location and world rotation

如果想在游戏场景中控制粒子特效的Rotation,需要勾选发射器Required组件中的Use Local Space选项,否则无论设置rotation值多少,其旋转角度始终是默认的初始值。 (查看大图,请复制图片链接在新窗口中打开)

If doesn’t check Use Local Space, particle would stop at spawned location even it be attached to a moveing Actor.

How to let Ribbon Data use velocity of a actor which particle attached it.

Uncheck Use Local Space in base emitter and ribbon data.

Ribbon Data

Question: How to make trail smooth?

Solution:
Spawn PerUnit -> Set Unit Scalar to 1.

Creating a Ribbon Emitter
https://www.youtube.com/watch?v=jBUF6at1s1o

How to make a emitter lifetime to be eternal

Solution:
Lifetime -> Set Lifetime to 0.f.

粒子循环播放

打开特效编辑器 -》 选中要循环播放的粒子(Emitter) -》 Spawn -》修改 Emitter Loops 为0,表示循环播放。

Events & Receivers

Spawning Particle with Events and Receivers

Spawning Particle with Events and Receivers
https://docs.unrealengine.com/4.27/en-US/Resources/ContentExamples/EffectsGallery/2_D/

Particle in C++

Issue: SpawnEmitterAttached 创建出来的粒子特效体积被放大

问题表现: 使用UGameplayStatics::SpawnEmitterAttached创建的粒子尺寸大小异常,变得非常大,比SpawnEmitterAtLocation()创建出来的粒子大差不多六七倍。

解决办法:

UParticleSystemComponent::bAbsoluteScale = true;

例子:

UParticleSystemComponent* PSC = UGameplayStatics::SpawnEmitterAttached(ParticleTemplate, Unit->GetMesh());
PSC->SetAbsolute(false, false, true);
How to play and destroy particle

Play particle:

UParticleSystemComponent* ParticleIns = UGameplayStatics::SpawnEmitterAtLocation(this, EmitterTemplate, Loc, Rot);

Destroy particle:

ParticleIns->DestroyComponent();
How to play Niagara FX using C++
UNiagaraComponent* NiagaraComp = UNiagaraFunctionLibrary::SpawnSystemAtLocation();
UNiagaraComponent* NiagaraComp = UNiagaraFunctionLibrary::SpawnSystemAttached()

Destroy Niagara:

NiagaraComp->DestroyComponent();
C++获取特效实例中的单个Emitter对象

UParticleSystemComponent 有个EmitterInstances属性,里面包含了特效中每个Emitter的相关信息:

TArray<struct FParticleEmitterInstance*> EmitterInstances;

人生在世,两种事应该少干:用自己的嘴干扰别人的人生;靠别人的脑子思考自己的人生。