Fixed Pivot issues

This commit is contained in:
LongLy 2024-11-29 12:30:36 -07:00
parent 532271aa75
commit ed26d40659
6 changed files with 4 additions and 4 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 30 KiB

View File

@ -266,7 +266,7 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateVelocityData(const float d
LocalVelocityDirection,
wasMovingLastUpdate);
bHasVelocity = !FMath::IsNearlyZero(LocalVelocity2D.SizeSquared2D());
bHasVelocity = (LocalVelocity2D.SizeSquared2D() > KINDA_SMALL_NUMBER);
// Call custom logic on blueprint.
BlueprintThreadSafeUpdateVelocityData(deltaSeconds);
@ -278,7 +278,7 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateAccelerationData(const flo
LocalAcceleration2D = UKismetMathLibrary::LessLess_VectorRotator(worldAcceleration2D, WorldRotation);
bHasAcceleration = (!FMath::IsNearlyZero(LocalAcceleration2D.SizeSquared2D(), KINDA_SMALL_NUMBER));
bHasAcceleration = (LocalAcceleration2D.SizeSquared2D() > KINDA_SMALL_NUMBER);
PivotDirection2D =
UKismetMathLibrary::Normal(UKismetMathLibrary::VLerp(PivotDirection2D, UKismetMathLibrary::Normal(worldAcceleration2D), .5f));
@ -301,12 +301,12 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateAccelerationData(const flo
}
const float desiredMaxSpeed = DesiredMaxSpeed * InputAmount;
if (LocalAcceleration2D.GetSafeNormal2D().Dot(LocalVelocity2D.GetSafeNormal2D()) < -.2f && WorldVelocity.Size2D() >
if (LocalAcceleration2D.GetSafeNormal2D().Dot(LocalVelocity2D.GetSafeNormal2D()) < -0.2f && WorldVelocity.Size2D() >
desiredMaxSpeed * 0.5f && HasAcceleration() && !bIsPivoting)
{
bIsPivoting = true;
}
else if (LocalAcceleration2D.GetSafeNormal2D().Dot(LocalVelocity2D.GetSafeNormal2D()) >= 0.f || !HasAcceleration())
else if (LocalAcceleration2D.GetSafeNormal2D().Dot(LocalVelocity2D.GetSafeNormal2D()) >= 0.f || !HasAcceleration() && bIsPivoting)
{
bIsPivoting = false;
}