Fixed Pivot issues
This commit is contained in:
parent
532271aa75
commit
ed26d40659
Binary file not shown.
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 30 KiB |
Binary file not shown.
Binary file not shown.
@ -266,7 +266,7 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateVelocityData(const float d
|
|||||||
LocalVelocityDirection,
|
LocalVelocityDirection,
|
||||||
wasMovingLastUpdate);
|
wasMovingLastUpdate);
|
||||||
|
|
||||||
bHasVelocity = !FMath::IsNearlyZero(LocalVelocity2D.SizeSquared2D());
|
bHasVelocity = (LocalVelocity2D.SizeSquared2D() > KINDA_SMALL_NUMBER);
|
||||||
|
|
||||||
// Call custom logic on blueprint.
|
// Call custom logic on blueprint.
|
||||||
BlueprintThreadSafeUpdateVelocityData(deltaSeconds);
|
BlueprintThreadSafeUpdateVelocityData(deltaSeconds);
|
||||||
@ -278,7 +278,7 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateAccelerationData(const flo
|
|||||||
|
|
||||||
LocalAcceleration2D = UKismetMathLibrary::LessLess_VectorRotator(worldAcceleration2D, WorldRotation);
|
LocalAcceleration2D = UKismetMathLibrary::LessLess_VectorRotator(worldAcceleration2D, WorldRotation);
|
||||||
|
|
||||||
bHasAcceleration = (!FMath::IsNearlyZero(LocalAcceleration2D.SizeSquared2D(), KINDA_SMALL_NUMBER));
|
bHasAcceleration = (LocalAcceleration2D.SizeSquared2D() > KINDA_SMALL_NUMBER);
|
||||||
|
|
||||||
PivotDirection2D =
|
PivotDirection2D =
|
||||||
UKismetMathLibrary::Normal(UKismetMathLibrary::VLerp(PivotDirection2D, UKismetMathLibrary::Normal(worldAcceleration2D), .5f));
|
UKismetMathLibrary::Normal(UKismetMathLibrary::VLerp(PivotDirection2D, UKismetMathLibrary::Normal(worldAcceleration2D), .5f));
|
||||||
@ -301,12 +301,12 @@ void UOLSBaseLayerAnimInstance::NativeThreadSafeUpdateAccelerationData(const flo
|
|||||||
}
|
}
|
||||||
|
|
||||||
const float desiredMaxSpeed = DesiredMaxSpeed * InputAmount;
|
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)
|
desiredMaxSpeed * 0.5f && HasAcceleration() && !bIsPivoting)
|
||||||
{
|
{
|
||||||
bIsPivoting = true;
|
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;
|
bIsPivoting = false;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user