How to know which side of a target actor that our character is approaching?

Imagine there is a enemy at a certain location, our character is walking toward the target, if our character is facing the back of the target, we can perform a backstabbing or if we approach from the side we can do some special attack etc.

Currently I use forward vector and have conditions on X, Y axis values.

It works but I think it might have a better approach.

Using Horizontal Dot product might help. In this example this is your character. When dot is 1 you are directly in front and -1 is directly behind while 0 is side by side.

float DotThreshold = 0.5f;
float DotFromEnemy;
DotFromEnemy = EnemyActor->GetHorizontalDotProductTo(this);
if (DotFromEnemy < (DotThreshold * -1f))
{
     // Behind the EnemyActor
}
else if (DotFromEnemy > DotThreshold)
{
     // In front of EnemyActor
}
else if (FMath::Abs(DotFromEnemy) <= DotThreshold)
{
     // Side of EnemyActor
}