Hello, I’m trying to make a component that has an effective direction and a desired one, like CMC has. The problem, however, is that my algorithm for some reason doesn’t work whenever the desired rotation is on “negative half of the world”, i.e. on 2nd and 3rd quadrants, relatively to the origin of the object I’m trying to rotate my vector around.

Here’s the way it works: 2022 12 06 18 51 24 - YouTube.

The thick gizmo represents the effective direction, while the thin one is the desired one. Initially the thick gizmo takes some time to rotate towards the player, after that it keeps following it without much problem until the player goes behind the object. That’s the problem. I have no idea why it does so.

The code:

```
FVector UTheComponent::RotateTowards(FVector InVelocity, float DeltaSeconds) const
{
const FVector V0 = InVelocity;
const FVector V1 = ComputeHomingDistanceVector();
const float DR = RotationRate * DeltaSeconds;
const FRotator R0 = V0.Rotation();
const FRotator R1 = V1.Rotation();
FRotator R = R1 - R0;
R.Yaw = FMath::Sign(R.Yaw) * FMath::Min(DR, FMath::Abs(R.Yaw));
R.Pitch = FMath::Sign(R.Pitch) * FMath::Min(DR, FMath::Abs(R.Pitch));
FVector RotatedVector = R.RotateVector(V0);
// Debug
const UWorld *World = GetWorld();
const FVector Base = UpdatedComponent->GetOwner()->GetActorLocation();
DrawGizmo(World, Base, RotatedVector, 4.f);
DrawGizmo(World, Base, V1, 2.f);
return RotatedVector;
}
```

Can anyone explain me why and how can I fix the issue? Thanks in advice.