UKismetMathLibrary::RInterpTo_Constant
#include "Kismet/KismetMathLibrary.h"
Access: public
Specifiers: staticUFUNCTIONBlueprintPure
Description
Rotates from Current toward Target at a constant angular rate (degrees per second) rather than slowing as it approaches, unlike RInterpTo. Reaches Target exactly and stops once there.
Caveats & Gotchas
- • InterpSpeed is degrees/second here, not a smoothing factor — the same number means something different than in RInterpTo, so don't reuse tuned values between the two functions.
- • Good choice for turret or camera turn rates where a fixed angular speed is expected, whereas RInterpTo is better for a natural ease-in-ease-out feel.
Signature
static FRotator RInterpTo_Constant(FRotator Current, FRotator Target, float DeltaTime, float InterpSpeed) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| Current | FRotator | The actual rotation this tick. | — |
| Target | FRotator | The rotation being tracked. | — |
| DeltaTime | float | Time since the last update, typically the frame's delta time. | — |
| InterpSpeed | float | Constant rate of rotation in degrees per second. | — |
Return Type
FRotator Example
Turn a turret toward a target at a fixed angular speed C++
void ATurret::Tick(float DeltaTime)
{
Super::Tick(DeltaTime);
FRotator NewRotation = UKismetMathLibrary::RInterpTo_Constant(GetActorRotation(), TargetRotation, DeltaTime, 45.0f);
SetActorRotation(NewRotation);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?