FTransform USplineComponent::GetTransformAtTime(float Time, ESplineCoordinateSpace::Type CoordinateSpace, bool bUseConstantVelocity, bool bUseScale) const
{
if (Duration == 0.0f)
{
return FTransform::Identity;
}
if (bUseConstantVelocity)
{
return GetTransformAtDistanceAlongSpline(Time / Duration * GetSplineLength(), CoordinateSpace, bUseScale);
}
else
{
const int32 NumPoints = SplineCurves.Position.Points.Num();
const int32 NumSegments = bClosedLoop ? NumPoints : NumPoints - 1;
const float TimeMultiplier = NumSegments / Duration;
return GetTransformAtSplineInputKey(Time * TimeMultiplier, CoordinateSpace, bUseScale);
}
}