ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • 임펙트 파티클
    Game Programming/언리얼 2023. 10. 3. 16:40
    /* Particles spawnd upon bullet impact*/
    UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = "true"));
    class UParticleSystem* ImpactParticles;
    
    /* Particles spawnd upon bullet impact*/
    UPROPERTY(EditAnyWhere, BlueprintReadWrite, Category = Combat, meta = (AllowPrivateAccess = "true"));
    class UParticleSystem* ImpactWallParticles;
    ConstructorHelpers::FObjectFinder<UParticleSystem> ImpactParticleAsset(
    TEXT("/Game/Voyager/Demo/Levels/UndergroundBaseLevel/Particles/P_spark_burst.P_spark_burst")
    );
    
    ImpactParticles = ImpactParticleAsset.Object;
    ConstructorHelpers::FObjectFinder<UParticleSystem> ImpactWallParticleAsset(
    TEXT("/Game/ParagonLtBelica/FX/Particles/Belica/Abilities/Primary/FX/P_BelicaHitWorld.P_BelicaHitWorld")
    );
    
    ImpactWallParticles = ImpactWallParticleAsset.Object;

    파티클 시스템을 추가했다.

    if (FireHit.bBlockingHit)
    {
        DrawDebugLine(GetWorld(), Start, End, FColor::Red, false, 2.f);
        DrawDebugPoint(GetWorld(), FireHit.Location, 5.f, FColor::Red, false, 2.f);
    
        if (ImpactParticles)
        {
            UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactWallParticles, FireHit.Location);
            UGameplayStatics::SpawnEmitterAtLocation(GetWorld(), ImpactParticles, FireHit.Location);
            GEngine->AddOnScreenDebugMessage(1, 1, FColor::Blue, FString::Printf(TEXT("Current: %f %f %f"), Start.X, Start.Y, Start.Z));
            GEngine->AddOnScreenDebugMessage(2, 1, FColor::Red, FString::Printf(TEXT("Collisioin: %f %f %f"), FireHit.Location.X, FireHit.Location.Y, FireHit.Location.Z));
        }
    }

    라인트레이스에서 충돌이 발생했으면 파티클을 생성했다.

    'Game Programming > 언리얼' 카테고리의 다른 글

    총알 이펙트  (0) 2023.10.04
    빔 파티클  (1) 2023.10.03
    라인 트레이스 추가  (0) 2023.10.03
    Animation Montage  (0) 2023.10.03
    Muzzle Flash  (0) 2023.09.30
Designed by Tistory.