Bugfix Getting Shot and Taking No Damage

This commit is contained in:
Philip W 2024-03-13 21:44:04 +00:00
parent 9ab356f813
commit 3b41b28b4c

View File

@ -25,7 +25,7 @@ EBTNodeResult::Type UBTTask_AttackPlayer::ExecuteTask(UBehaviorTreeComponent& Ow
{ {
GunSKMesh = Cast<USkeletalMeshComponent>(AIController->GetPawn()->GetComponentsByTag(USkeletalMeshComponent::StaticClass(), "Gun")[0]); GunSKMesh = Cast<USkeletalMeshComponent>(AIController->GetPawn()->GetComponentsByTag(USkeletalMeshComponent::StaticClass(), "Gun")[0]);
} }
FVector const Origin = IsValid(GunSKMesh) ? GunSKMesh->GetComponentLocation() : AIController->GetPawn()->GetActorLocation() + FVector(0.f, 0.f, 30.f); FVector const Origin = IsValid(GunSKMesh) ? GunSKMesh->GetSocketLocation("Muzzle") : AIController->GetPawn()->GetActorLocation() + FVector(0.f, 0.f, 30.f);
FVector const Start = Origin; FVector const Start = Origin;
FVector const End = Origin + AIController->GetPawn()->GetActorForwardVector() * 100000.f; FVector const End = Origin + AIController->GetPawn()->GetActorForwardVector() * 100000.f;
if (AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(AIController->GetPawn())) if (AEnemyCharacter* const EnemyCharacter = Cast<AEnemyCharacter>(AIController->GetPawn()))