Added a temporary fix for pivot

This commit is contained in:
LongLy 2024-11-23 10:42:10 -07:00
parent 1fee8c3bcb
commit da33f5e6a7
5 changed files with 26 additions and 4 deletions

View File

@ -1,10 +1,10 @@
/Engine=C:/Program Files/Epic Games/UE_5.5/Engine/Shaders
/ShaderAutogen=H:/Projects/OLS/Intermediate/ShaderAutogen
/NFORDenoise=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Experimental/NFORDenoise/Shaders
/Plugin/FX/Niagara=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/FX/Niagara/Shaders
/Plugin/GLTFExporter=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Enterprise/GLTFExporter/Shaders
/Plugin/ExrReaderShaders=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Media/ImgMedia/Shaders
/NNEDenoiserShaders=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/NNE/NNEDenoiser/Shaders
/Plugin/GLTFExporter=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Enterprise/GLTFExporter/Shaders
/Plugin/FX/Niagara=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/FX/Niagara/Shaders
/Plugin/ExrReaderShaders=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Media/ImgMedia/Shaders
/Plugin/WmfMedia=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Media/WmfMedia/Shaders
/Plugin/ComputeFramework=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Runtime/ComputeFramework/Shaders
/Plugin/Runtime/HairStrands=C:/Program Files/Epic Games/UE_5.5/Engine/Plugins/Runtime/HairStrands/Shaders

View File

@ -271,7 +271,7 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateAccelerationData(const flo
LocalAcceleration2D = UKismetMathLibrary::LessLess_VectorRotator(worldAcceleration2D, WorldRotation);
bHasAcceleration = (!FMath::IsNearlyZero(LocalAcceleration2D.SizeSquared2D(), .000001f));
bHasAcceleration = (!FMath::IsNearlyZero(LocalAcceleration2D.SizeSquared2D(), KINDA_SMALL_NUMBER));
PivotDirection2D =
UKismetMathLibrary::Normal(UKismetMathLibrary::VLerp(PivotDirection2D, UKismetMathLibrary::Normal(worldAcceleration2D), .5f));
@ -283,6 +283,22 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateAccelerationData(const flo
CardinalDirectionDeadZone, EOLSCardinalDirection::EForward))
: EOLSCardinalDirection::EBackward);
if (HasAcceleration())
{
const float directionSign = FMath::Sign(
UKismetAnimationLibrary::CalculateDirection(OwningPawnAcceleration, WorldRotation));
TurnDirection = FMath::FloorToInt(directionSign);
}
if (LocalAcceleration2D.GetSafeNormal2D().Dot(LocalVelocity2D.GetSafeNormal2D()) < -.2f && HasAcceleration() && !bIsPivoting)
{
bIsPivoting = true;
}
else if (LocalAcceleration2D.GetSafeNormal2D().Dot(LocalVelocity2D.GetSafeNormal2D()) >= 0.f || !HasAcceleration())
{
bIsPivoting = false;
}
// Call custom logic on blueprint.
BlueprintThreadSafeUpdateAccelerationData(deltaSeconds);
}

View File

@ -245,9 +245,15 @@ protected:
UPROPERTY(BlueprintReadOnly, Category = "ThreadSafe|AccelerationData")
FVector LocalAcceleration2D = FVector::ZeroVector;
UPROPERTY(BlueprintReadOnly, Category = "ThreadSafe|AccelerationData")
int32 TurnDirection = 0;
UPROPERTY(BlueprintReadOnly, Category = "ThreadSafe|AccelerationData")
uint8 bHasAcceleration : 1;
UPROPERTY(BlueprintReadOnly, Category = "ThreadSafe|AccelerationData")
uint8 bIsPivoting : 1;
UPROPERTY(BlueprintReadOnly, Category = "ThreadSafe|AccelerationData")
FVector PivotDirection2D = FVector::ZeroVector;