feat: 加入了动画插值
This commit is contained in:
@@ -22,8 +22,10 @@ void AMyCharacter::Move(const FInputActionValue& Value)
|
||||
// 转向
|
||||
if (f2d.SizeSquared() > 0.01f)
|
||||
{
|
||||
FRotator Rot = FRotator(0, FMath::Atan2(f2d.Y, f2d.X) * 180.0f / PI, 0);
|
||||
SetActorRotation(Rot);
|
||||
FRotator Rot = FVector(f2d.X, f2d.Y, 0).Rotation() + FRotator(0, GetControlRotation().Yaw, 0);
|
||||
float InterpSpeed = 10.0f;
|
||||
FRotator NewRotation = FMath::RInterpTo(GetActorRotation(), Rot, GetWorld()->GetDeltaSeconds(), InterpSpeed);
|
||||
SetActorRotation(NewRotation);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user