Is the avoidance of going the long way round correct in the course?

I may have missed something here but to avoid the long way round, shouldn’t it look like this?

float yaw = 0.0;
if (FMath::Abs(barrelDelta.Yaw) < 180.0f)
{
yaw = barrelDelta.Yaw;
}
else
{
float phi = FMath::Sign(barrelDelta.Yaw);
yaw = barrelDelta.Yaw - phi * 360.0f;
}
Turret->Rotate(yaw);

i.e. -200 degrees is not the same as 200 degrees?

1 Like

Privacy & Terms