글을 쓰는 목적
ParticleSystemCompnent Trail 기능을 사용하다가 헤맸던 구간이 있어서 기록하기 위해 글을 적는다.
작업 환경
UE4.26
ParticleSystemComponent Trails 적용하기
ParticleSystemComponent의 Trails 이펙트를 사용법
- ParticleSystemComponent를 MeshComponent에 하위에 Attach
- ParitcleSystemComponent의 Template 를 설정
- BeginTrails로 Trails 이펙트 시작(BeginTrails에 소켓 이름, 소켓 이름, 이펙트 스폰 위치 Enum, 넓이를 설정한다.)
- EndTrails로 Trails 이펙트 종료
UCLASS()
class ATestParticleSystemComponent : public AActor
{
GENERATED_BODY()
public:
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UStaticMeshCompnent* Mesh;
UPROPERTY(EditAnywhere, BlueprintReadWrite)
UParticleSystemComponent* TrailParticleSystemComponent;
public:
ATestParticleSystemComponent();
virtual void Begin() override;
}
ATestParticleSystemComponent::ATestParticleSystemComponent()
{
Mesh = CreataeDefaultSuboject<UStaticMeshComponent>(TEXT("Mesh"));
TrailParticleSystemComponent = CreateDefaultSuboject<UParticleSystemComponent>(TEXT("TrailParticleComp"));
TrailParticleSystemComponent->AttachToComponent(Mesh, FAttachmentTransform::KeepRelativeTransform);
}
void ATestParticleSystemComponent::BeginPlay()
{
Super::BeginPlay();
TrailParticleSystemComponent->BeginTrails(SOCKET_1, SOCKET_2, ETrailWidthMode::ETRailWidthMode_FromCentre, 1);
}
작업하면서 Trails가 나오지 않아 헤맸다 원인은 ParticleSystemComponent가 StaticMesh 하위에 붙어 있지 않으면 정상적으로 Trail이 나오지 않도록 내부 코드가 짜여있었다. Trails를 사용하기 위해서는 StaticMesh 하위에 ParticleSystemComponent를 붙여야 한다.
'UE4' 카테고리의 다른 글
[UE4][BUG] Android에서 시작 맵이 변경되지 않는 현상 (0) | 2021.12.21 |
---|---|
UE4 Matrix Transformation C++ (0) | 2021.12.03 |
UE4 UMG Image에 Mask를 이용한 Material 적용 (0) | 2021.11.11 |
UE4 Change Overall Scalability C++ (0) | 2021.10.27 |
UE4 Android, iOS Battery, Wifi 정보 가져오기 (0) | 2021.10.27 |