From 92d7000dbe492c663245e76418c6042b50854039 Mon Sep 17 00:00:00 2001 From: Steve Streeting Date: Fri, 15 Mar 2024 10:18:03 +0000 Subject: [PATCH] Allow VLOG of camera collision to be turned on/off in the editor --- .../Private/StevesSpringArmComponent.cpp | 11 ++++------- .../StevesUEHelpers/Public/StevesSpringArmComponent.h | 4 ++++ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Source/StevesUEHelpers/Private/StevesSpringArmComponent.cpp b/Source/StevesUEHelpers/Private/StevesSpringArmComponent.cpp index e570529..6643553 100644 --- a/Source/StevesUEHelpers/Private/StevesSpringArmComponent.cpp +++ b/Source/StevesUEHelpers/Private/StevesSpringArmComponent.cpp @@ -1,10 +1,8 @@  #include "StevesSpringArmComponent.h" - #include "StevesUEHelpers.h" -// Set this to 1 to VLOG where camera is being occluded from -#define ENABLE_VLOG_CAMERA_OCCLUSION 0 + UStevesSpringArmComponent::UStevesSpringArmComponent() { @@ -17,9 +15,8 @@ FVector UStevesSpringArmComponent::BlendLocations(const FVector& DesiredArmLocat float DeltaTime) { -#if ENABLE_VLOG_CAMERA_OCCLUSION -#if ENABLE_VISUAL_LOG - if (bHitSomething) +#if WITH_EDITORONLY_DATA && ENABLE_VISUAL_LOG + if (bHitSomething && bVisualLogCameraCollision) { FVector NewDesiredLoc = PreviousDesiredLoc - PreviousDesiredRot.Vector() * TargetArmLength; // Add socket offset in local space @@ -33,7 +30,7 @@ FVector UStevesSpringArmComponent::BlendLocations(const FVector& DesiredArmLocat } } #endif -#endif + // These locations are in world space, we only want to blend the arm length, not the rest const FVector Base = Super::BlendLocations(DesiredArmLocation, TraceHitLocation, bHitSomething, DeltaTime); diff --git a/Source/StevesUEHelpers/Public/StevesSpringArmComponent.h b/Source/StevesUEHelpers/Public/StevesSpringArmComponent.h index 32c43cc..099f8a5 100644 --- a/Source/StevesUEHelpers/Public/StevesSpringArmComponent.h +++ b/Source/StevesUEHelpers/Public/StevesSpringArmComponent.h @@ -21,6 +21,10 @@ public: protected: TOptional PrevArmLength; +#if WITH_EDITORONLY_DATA + UPROPERTY(Transient, EditAnywhere, Category=CameraCollision) + bool bVisualLogCameraCollision = false; +#endif public: UStevesSpringArmComponent();