NativeUpdateAnimation을 재정의 하여 Speed와 Direction, 점프상태를 체크할것
다음과 같이 내적을 이용하여 정면과 옆면의 벡터길이를 구하고
#include "TPSPlayerAnim.h"
#include "GameFramework/PawnMovementComponent.h"
void UTPSPlayerAnim::NativeUpdateAnimation(float DeltaSeconds)
{
Super::NativeUpdateAnimation(DeltaSeconds);
if (!Owner->IsValidLowLevel())
{
Owner = TryGetPawnOwner();
}
else
{
FVector v = Owner->GetVelocity();
Speed = FVector::DotProduct(v, Owner->GetActorForwardVector());
Direction = FVector::DotProduct(v, Owner->GetActorRightVector());
bIsInAir = Owner->GetMovementComponent()->IsFalling();
}
}
양수와 음수를 기준으로 트랜지션을 설정해주었음