Bugfix Equipped Guns Block LOS for Vision Link

This commit is contained in:
RAFAL SWIERCZEK 2023-11-30 10:15:38 +00:00
parent 354b3b2a11
commit 331259cc1b
2 changed files with 12 additions and 4 deletions

Binary file not shown.

View File

@ -6,6 +6,7 @@
#include "CollisionDebugDrawingPublic.h"
#include "Kismet/KismetMathLibrary.h"
#include "Camera/CameraComponent.h"
#include "EndlessVendetta/EndlessVendettaCharacter.h"
#include "GameFramework/Character.h"
void AVisionLink::BeginPlay()
@ -46,9 +47,16 @@ void AVisionLink::SendOutPingPulse()
GetWorld()->GetTimerManager().SetTimer(PulseHandle, this, &AVisionLink::SendOutPingPulse, TimeInbetweenPingPulses, false);
PlayPingPulseAnim(TimeInbetweenPingPulses);
UCameraComponent* PlayerCamComp = Cast<UCameraComponent>(GetWorld()->GetFirstPlayerController()->GetCharacter()->GetComponentByClass(UCameraComponent::StaticClass()));
ACharacter* PlayersCharacter = GetWorld()->GetFirstPlayerController()->GetCharacter();
UCameraComponent* PlayerCamComp = Cast<UCameraComponent>(PlayersCharacter->GetComponentByClass(UCameraComponent::StaticClass()));
// Ignored Actors
TArray<AActor*> ActorsToIgnore;
ActorsToIgnore.Add(GetWorld()->GetFirstPlayerController()->GetCharacter());
AEndlessVendettaCharacter* EV_Character = Cast<AEndlessVendettaCharacter>(PlayersCharacter);
if ( IsValid(EV_Character) && IsValid(EV_Character->PrimaryWeaponActor)) ActorsToIgnore.Add(EV_Character->PrimaryWeaponActor);
if ( IsValid(EV_Character) && IsValid(EV_Character->SecondaryWeaponActor)) ActorsToIgnore.Add(EV_Character->SecondaryWeaponActor);
ActorsToIgnore.Add(PlayersCharacter);
TestLOS(PlayerCamComp->GetComponentTransform(), ActorsToIgnore);
}