Add extra checking for field system spawning
This commit is contained in:
parent
a8adf8abfb
commit
7256afd8bf
|
@ -265,9 +265,17 @@ void APlayerCharacter::ProcessHits(TArray<FHitResult> hits)
|
|||
SpawnParameters.SpawnCollisionHandlingOverride = ESpawnActorCollisionHandlingMethod::AlwaysSpawn;
|
||||
|
||||
// Spawn field actor
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
||||
if (CurrentWeapon->GetFieldSystemActor())
|
||||
{
|
||||
FTransform transform;
|
||||
transform.SetLocation(Hit.ImpactPoint);
|
||||
auto field = GetWorld()->SpawnActor<AFieldSystemActor>(CurrentWeapon->GetFieldSystemActor(), transform, SpawnParameters);
|
||||
|
||||
if (field)
|
||||
{
|
||||
field->Destroy();
|
||||
}
|
||||
}
|
||||
|
||||
if (Hit.GetActor())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue