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

View File

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