官方文档:
FMath::RInterpConstantTo
https://docs.unrealengine.com/latest/INT/API/Runtime/Core/Math/FMath/RInterpConstantTo/index.html
例子:
bool UShipMovementComponent::AcceptTurnToRotator(const FRotator& RotateTo)
{
if(FMath::Abs(RotateTo.Yaw - UpdatedComponent->GetComponentRotation().Yaw) < 0.1f)
{
return true;
}
FRotator tmpRot = FMath::RInterpConstantTo(UpdatedComponent->GetComponentRotation(),
RotateTo, GetWorld()->GetDeltaSeconds(),
AngularSpeed);
AcceptedRotator = tmpRot;
return false;
}