Spawn FieldSystemActor at Hit Result Impact Point

This commit is contained in:
Louis Hobbs 2023-01-31 21:27:36 +00:00
parent 97c937d212
commit a0c125c424
1 changed files with 7 additions and 0 deletions

View File

@ -239,6 +239,13 @@ void APlayerCharacter::CalculateHits(TArray<FHitResult>* 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<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
if (Result.GetActor()->ActorHasTag(FName("Destructable")))
{