FMath::RInterpTo를 사용하여 급격한 회전 없이 타겟을 자연스럽게 추적하는
보간(Interpolation) 로직을 적용했습니다.
또한 피격이나 스턴 발생 시 StopAllMontages와 StopMovementImmediately를 호출하여
선행 동작을 즉시 캔슬하는 인터럽트(Interrupt) 시스템을 구축했습니다.
//Boss1.cpp
void ABoss1::Tick(float DeltaTime)
{
//Target Interpolation
if (BossState != EBossState::Dead)
{
//타겟 방향 벡터 계산
FVector Direction = Player->GetActorLocation() - GetActorLocation();
Direction.Z = 0;
FRotator TargetRotation = Direction.Rotation();
//RInterpTo를 활용한 부드러운 회전 보간 (Smooth Rotation)
FRotator NewRotation = FMath::RInterpTo(GetActorRotation(), TargetRotation, DeltaTime, 5.f);
SetActorRotation(NewRotation);
}
}
//Action Interrupt
void ABoss1::EnterStunned(float Duration)
{
//패링 당했을 시 현재 행동 강제 캔슬(Action Cancel)
if (UAnimInstance* AnimInst = GetMesh()->GetAnimInstance())
{
//재생 중인 모든 공격 애니메이션 즉시 중단(BlendOut 0.2s)
AnimInst->StopAllMontages(0.2f);
}
//이동 관성 즉시 제거
if (GetCharacterMovement())
{
GetCharacterMovement()->StopMovementImmediately();
}
}