From d233e4bed6be30117b8c397742714e2c181c9164 Mon Sep 17 00:00:00 2001 From: ameaninglessname Date: Tue, 4 Oct 2022 15:44:38 +0800 Subject: [PATCH] Temporary code for debugging https://github.com/dyanikoglu/ALS-Community/issues/258 shaking tool problem: in order to get rid of the rotation noise from the build in system, I override UALSCharacterMovementComponent::SmoothCorrection to skip net correction BY DEFAULT, disable it with "Als.Debug.bSkipSmoothCorrection 0" --- .../Character/ALSCharacterMovementComponent.cpp | 14 +++++++++++++- .../Character/ALSCharacterMovementComponent.h | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp b/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp index 9375f9fd..ce921807 100644 --- a/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp +++ b/Source/ALSV4_CPP/Private/Character/ALSCharacterMovementComponent.cpp @@ -66,7 +66,19 @@ float UALSCharacterMovementComponent::GetMaxBrakingDeceleration() const return CurrentMovementSettings.MovementCurve->GetVectorValue(GetMappedSpeed()).Y; } -void UALSCharacterMovementComponent::UpdateFromCompressedFlags(uint8 Flags) // Client only +bool bSkipSmoothCorrection = true; +FAutoConsoleVariableRef CVarRef_bSkipSmoothCorrection(TEXT("Als.Debug.bSkipSmoothCorrection"), bSkipSmoothCorrection, TEXT("")); + +void UALSCharacterMovementComponent::SmoothCorrection(const FVector& OldLocation, const FQuat& OldRotation, + const FVector& NewLocation, const FQuat& NewRotation) +{ + if (!bSkipSmoothCorrection) + { + Super::SmoothCorrection(OldLocation, OldRotation, NewLocation, NewRotation); + } +} + +void UALSCharacterMovementComponent::UpdateFromCompressedFlags(const uint8 Flags) // Client only { Super::UpdateFromCompressedFlags(Flags); diff --git a/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h b/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h index b382819e..8015d426 100644 --- a/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h +++ b/Source/ALSV4_CPP/Public/Character/ALSCharacterMovementComponent.h @@ -52,6 +52,7 @@ class ALSV4_CPP_API UALSCharacterMovementComponent : public UCharacterMovementCo virtual void PhysWalking(float DeltaTime, int32 Iterations) override; virtual float GetMaxAcceleration() const override; virtual float GetMaxBrakingDeceleration() const override; + virtual void SmoothCorrection(const FVector& OldLocation, const FQuat& OldRotation, const FVector& NewLocation, const FQuat& NewRotation) override; // Movement Settings Variables UPROPERTY()