static UParticleSystemComponent* SpawnEmitterAtLocation(const UObject* WorldContextObject, UParticleSystem* EmitterTemplate, FVector Location, FRotator Rotation = FRotator::ZeroRotator, FVector Scale = FVector(1.f), bool bAutoDestroy = true, EPSCPoolMethod PoolingMethod = EPSCPoolMethod::None, bool bAutoActivateSystem = true);
static UNiagaraComponent* SpawnSystemAtLocation(const UObject* WorldContextObject, class UNiagaraSystem* SystemTemplate, FVector Location, FRotator Rotation = FRotator::ZeroRotator, FVector Scale = FVector(1.f), bool bAutoDestroy = true, bool bAutoActivate = true, ENCPoolMethod PoolingMethod = ENCPoolMethod::None, bool bPreCullCheck = true);
const FAttachmentTransformRules AttachmentTransformRules(EAttachmentRule::SnapToTarget, EAttachmentRule::SnapToTarget, EAttachmentRule::KeepRelative, false);
Effect->AttachToComponent(AttachToComponent, AttachmentTransformRules, AttachPointName);
이펙트를 AtLocation 함수로 월드에 스폰한 후 Effect를 AttachToComponent 함수로 특정 Component에 부착했을 경우 Component의 위치에 따라 Effect가 따라가지 않는다.
static UParticleSystemComponent* SpawnEmitterAttached(class UParticleSystem* EmitterTemplate, class USceneComponent* AttachToComponent, FName AttachPointName = NAME_None, FVector Location = FVector(ForceInit), FRotator Rotation = FRotator::ZeroRotator, FVector Scale = FVector(1.f), EAttachLocation::Type LocationType = EAttachLocation::KeepRelativeOffset, bool bAutoDestroy = true, EPSCPoolMethod PoolingMethod = EPSCPoolMethod::None, bool bAutoActivate=true);
static UNiagaraComponent* SpawnSystemAttached(UNiagaraSystem* SystemTemplate, USceneComponent* AttachToComponent, FName AttachPointName, FVector Location, FRotator Rotation, EAttachLocation::Type LocationType, bool bAutoDestroy, bool bAutoActivate = true, ENCPoolMethod PoolingMethod = ENCPoolMethod::None, bool bPreCullCheck = true);
Effect->DetachFromComponent(FDetachmentTransformRules::KeepRelativeTransform);
Effect->SetWorldLocationAndRotation(Location, Rotation);
이펙트를 Attached 함수로 스폰한 후 DetachFromComponent 함수로 Detach한 후 Location과 Rotation을 사용한 후 필요에 따라 AttachToComponent 함수를 사용하면 부착한 Component의 위치에 따라 Effect가 따라간다.
'Unreal Engine > Effect' 카테고리의 다른 글
[Unreal Engine Effect] Effect의 Render Custom Depth (0) | 2023.09.18 |
---|---|
[Unreal Engine 4 Effect] 나이아가라 이펙트 Scale 조절하기 (0) | 2023.06.07 |