UKismetMathLibrary::MakeFrameRate
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Constructs an FFrameRate from a numerator and denominator, enforcing that the denominator is at least 1. Allows exact representation of NTSC rates like 29.97 (30000/1001) without floating-point approximation.
Caveats & Gotchas
- • The function enforces Denominator >= 1, so passing 0 will be clamped to 1 silently. There is no assertion or log warning — the caller receives a valid FFrameRate(Numerator, 1) without knowing the clamp happened.
- • Common NTSC drop-frame rates (29.97, 59.94) require exact rational representation: 30000/1001 and 60000/1001 respectively. Using 30/1 or 60/1 introduces small but accumulating frame drift over long sequences.
Signature
static ENGINE_API FFrameRate MakeFrameRate(int32 Numerator, int32 Denominator = 1); Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Numerator | int32 | The frame rate numerator (e.g. 30 for 30 fps, 30000 for 29.97 fps drop-frame). | — |
| Denominator | int32 | The frame rate denominator. Defaults to 1. Must be at least 1. | 1 |
Return Type
FFrameRate Example
Create a 29.97 fps frame rate for NTSC video C++
FFrameRate NTSCRate = UKismetMathLibrary::MakeFrameRate(30000, 1001); // 29.97 fps
FFrameRate FilmRate = UKismetMathLibrary::MakeFrameRate(24); // 24 fps (default denom=1) Tags
Version History
Introduced in: 4.23
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?