From a0c125c4248d0a0fd775cf81a0879921011ad8c7 Mon Sep 17 00:00:00 2001 From: Louis Hobbs Date: Tue, 31 Jan 2023 21:27:36 +0000 Subject: [PATCH] Spawn FieldSystemActor at Hit Result Impact Point --- Source/Nakatomi/PlayerCharacter.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/Source/Nakatomi/PlayerCharacter.cpp b/Source/Nakatomi/PlayerCharacter.cpp index 40150b4..9c59231 100644 --- a/Source/Nakatomi/PlayerCharacter.cpp +++ b/Source/Nakatomi/PlayerCharacter.cpp @@ -239,6 +239,13 @@ void APlayerCharacter::CalculateHits(TArray* hits) DrawDebugLine(GetWorld(), TraceStart, Result.ImpactPoint, FColor::Blue, true, 500, 0U, 0); // TODO: Handle hits in a meaningful way + FActorSpawnParameters SpawnParameters; + SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn; + + // Spawn field actor + FTransform transform; + transform.SetLocation(Result.ImpactPoint); + GetWorld()->SpawnActor(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters); if (Result.GetActor()->ActorHasTag(FName("Destructable"))) {