Bugfix Force Look Pitch Not Correctly Set

This commit is contained in:
Philip W 2023-04-28 03:59:03 +01:00
parent 9ecbd9c52d
commit 38ffd4f339
4 changed files with 11 additions and 9 deletions

BIN
Content/BlueprintAI/AI/AIBruh.uasset (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
Content/Levels/Build.umap (Stored with Git LFS)

Binary file not shown.

View File

@ -10,6 +10,7 @@
#include "Components/TextBlock.h" #include "Components/TextBlock.h"
#include "Components/ProgressBar.h" #include "Components/ProgressBar.h"
#include "Kismet/GameplayStatics.h" #include "Kismet/GameplayStatics.h"
#include "Kismet/KismetMathLibrary.h"
#include "Misc/OutputDeviceNull.h" #include "Misc/OutputDeviceNull.h"
#include "the_twilight_abyss/PlayerTemp/TempCharacter.h" #include "the_twilight_abyss/PlayerTemp/TempCharacter.h"
@ -56,7 +57,8 @@ void ATurnBaseCombatV2::StartCombat(AActor* Enemy, bool bWasShot)
FVector Direction = Enemy->GetActorLocation() - PlayerActor->GetActorLocation(); FVector Direction = Enemy->GetActorLocation() - PlayerActor->GetActorLocation();
Direction.Normalize(); Direction.Normalize();
FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator(); FRotator LookAtRotation = FRotationMatrix::MakeFromX(Direction).Rotator();
LookAtRotation.Pitch = -9.0f; const FRotator NewRotation = UKismetMathLibrary::FindLookAtRotation(Cast<UCameraComponent>(PlayerActor->FindComponentByClass<UCameraComponent>())->GetComponentLocation(), Cast<USkeletalMeshComponent>(EnemyActor->FindComponentByClass<USkeletalMeshComponent>())->GetComponentLocation());
LookAtRotation.Pitch = NewRotation.Pitch - PlayerActor->GetActorRotation().Pitch;
PlayerController->SetControlRotation(LookAtRotation); PlayerController->SetControlRotation(LookAtRotation);
if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return; if (EnemyBlackboard->GetValueAsBool("IsInCombat")) return;