From 0c3831ad03e2e6ca811b4b43258e3be1c920e6a2 Mon Sep 17 00:00:00 2001 From: PHILIP White Date: Mon, 22 May 2023 01:03:13 +0100 Subject: [PATCH] Bugfix Camera Being Reset in Wrong Positions and FOV --- Content/Blueprints/Player/BP_MyTempCharacter.uasset | 4 ++-- Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp | 8 ++++---- Source/the_twilight_abyss/PlayerTemp/TempCharacter.h | 4 ++-- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Content/Blueprints/Player/BP_MyTempCharacter.uasset b/Content/Blueprints/Player/BP_MyTempCharacter.uasset index 140c2b6..e083718 100644 --- a/Content/Blueprints/Player/BP_MyTempCharacter.uasset +++ b/Content/Blueprints/Player/BP_MyTempCharacter.uasset @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:39f92dafa310a716d7eb327b58a577fda125fcb5273fde6c05a11f5c850383a2 -size 261013 +oid sha256:eb1a664c88e22fc70a6ac33762af14b042f6d37eda86542ca423f6d8a2dec62d +size 264709 diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp index 54b0630..85f2c3e 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.cpp @@ -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); diff --git a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h index 8454211..dd3d05f 100644 --- a/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h +++ b/Source/the_twilight_abyss/PlayerTemp/TempCharacter.h @@ -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;