Bugfix Camera Being Reset in Wrong Positions and FOV

This commit is contained in:
Philip W 2023-05-22 01:03:13 +01:00
parent e947b67b36
commit 0c3831ad03
3 changed files with 8 additions and 8 deletions

Binary file not shown.

View File

@ -262,7 +262,7 @@ void ATempCharacter::AddToInventory()
} }
} }
void ATempCharacter::InputDisabler() void ATempCharacter::InputDisabler(const bool SetCamera)
{ {
CrossHairWidget->SetVisibility(ESlateVisibility::Hidden); CrossHairWidget->SetVisibility(ESlateVisibility::Hidden);
@ -274,7 +274,7 @@ void ATempCharacter::InputDisabler()
PlayerController->SetIgnoreLookInput(true); PlayerController->SetIgnoreLookInput(true);
disableTab = true; disableTab = true;
if (ThisCamera != nullptr) if (ThisCamera != nullptr && SetCamera)
{ {
OriginalCameraLocation = ThisCamera->GetComponentLocation(); OriginalCameraLocation = ThisCamera->GetComponentLocation();
OriginalCameraRotation = ThisCamera->GetComponentRotation(); OriginalCameraRotation = ThisCamera->GetComponentRotation();
@ -283,7 +283,7 @@ void ATempCharacter::InputDisabler()
} }
} }
void ATempCharacter::InputEnabler() void ATempCharacter::InputEnabler(const bool SetCamera)
{ {
//Reset UI Mode //Reset UI Mode
APlayerController* PlayerController = GetWorld()->GetFirstPlayerController(); APlayerController* PlayerController = GetWorld()->GetFirstPlayerController();
@ -302,7 +302,7 @@ void ATempCharacter::InputEnabler()
UE_LOG(LogTemp, Display, TEXT("Enabling Inputs")); UE_LOG(LogTemp, Display, TEXT("Enabling Inputs"));
disableTab = true; disableTab = true;
TraceDistance = 300; TraceDistance = 300;
if (ThisCamera != nullptr) if (ThisCamera != nullptr && SetCamera)
{ {
ThisCamera->SetWorldLocation(OriginalCameraLocation); ThisCamera->SetWorldLocation(OriginalCameraLocation);
ThisCamera->SetWorldRotation(OriginalCameraRotation); ThisCamera->SetWorldRotation(OriginalCameraRotation);

View File

@ -66,7 +66,7 @@ public:
float TraceDistance = 200; float TraceDistance = 200;
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InputDisabler(); void InputDisabler(bool SetCamera = true);
void LineTraceLogic(); void LineTraceLogic();
@ -87,7 +87,7 @@ public:
void UseItem(class UBaseItem* Item); // Overriding the BaseItem Class void UseItem(class UBaseItem* Item); // Overriding the BaseItem Class
UFUNCTION(BlueprintCallable) UFUNCTION(BlueprintCallable)
void InputEnabler(); void InputEnabler(bool SetCamera = true);
UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera") UPROPERTY(EditAnywhere, BlueprintReadWrite, Category = "Camera")
UCameraComponent* ThisCamera; UCameraComponent* ThisCamera;