diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 82ab14b..b730402 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -396,6 +396,19 @@ void APlayerCharacter::ProcessHits(TArray hits) rot.Yaw += 180.0f; decalActor->SetActorRotation(rot); } + + if (staticMeshComponent && !staticMeshComponent->IsSimulatingPhysics() && + CurrentWeapon->GetImpactParticleSystem()) + { + FTransform transform; + transform.SetLocation(Hit.ImpactPoint); + + UGameplayStatics::SpawnEmitterAtLocation(this, + CurrentWeapon->GetImpactParticleSystem(), + transform.GetLocation(), + FRotator::ZeroRotator, + true); + } } } } diff --git a/Source/Nakatomi/Weapon.cpp b/Source/Nakatomi/Weapon.cpp index 377f647..da7c20e 100644 --- a/Source/Nakatomi/Weapon.cpp +++ b/Source/Nakatomi/Weapon.cpp @@ -125,6 +125,11 @@ TSubclassOf AWeapon::GetDecalActor() return DecalActor; } +UParticleSystem* AWeapon::GetImpactParticleSystem() +{ + return ImpactParticleSystem; +} + TSubclassOf AWeapon::GetFieldSystemActor() { return FieldSystemActor; diff --git a/Source/Nakatomi/Weapon.h b/Source/Nakatomi/Weapon.h index d1901f1..ddc9bdd 100644 --- a/Source/Nakatomi/Weapon.h +++ b/Source/Nakatomi/Weapon.h @@ -55,6 +55,9 @@ protected: UPROPERTY(EditDefaultsOnly) TSubclassOf DecalActor; + UPROPERTY(EditDefaultsOnly) + UParticleSystem* ImpactParticleSystem; + public: // Sets default values for this actor's properties AWeapon(); @@ -101,4 +104,6 @@ public: TSubclassOf GetWeaponThrowableTemplate(); TSubclassOf GetDecalActor(); + + UParticleSystem* GetImpactParticleSystem(); };