diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index dcecbf4..82ab14b 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -381,6 +381,21 @@ void APlayerCharacter::ProcessHits(TArray hits) } } } + + auto staticMeshComponent = Hit.GetActor()->GetComponentByClass(); + + if (staticMeshComponent && !staticMeshComponent->IsSimulatingPhysics() && CurrentWeapon->GetDecalActor()) + { + FTransform transform; + transform.SetLocation(Hit.ImpactPoint); + + auto decalActor = GetWorld()->SpawnActor(CurrentWeapon->GetDecalActor(), transform, + SpawnParameters); + auto rot = Hit.ImpactNormal.Rotation(); + rot.Roll += 90.0f; + rot.Yaw += 180.0f; + decalActor->SetActorRotation(rot); + } } } }