RealDocs

UKismetMathLibrary::FixedTurn

function Engine Blueprint Since 4.0
#include "Kismet/KismetMathLibrary.h"
Access: public Specifiers: staticBlueprintPureUFUNCTION

Description

Advances InCurrent toward InDesired by at most InDeltaRate degrees along the shortest angular path. The result is clamped to the range (-360, 360).

Caveats & Gotchas

  • • Operates on a single rotation component (yaw, pitch, or roll), not a full FRotator. Apply it independently to each axis if you need full 3D rotation tracking.
  • • InDeltaRate must be multiplied by DeltaTime before passing to achieve frame-rate-independent rotation speed. Passing a constant produces frame-rate-dependent behavior.

Signature

static UE_INL_API float FixedTurn(float InCurrent, float InDesired, float InDeltaRate);

Parameters

Name Type Description Default
InCurrent float Current rotation component value in degrees. —
InDesired float Target rotation component value in degrees. —
InDeltaRate float Maximum degrees to advance this call. —

Return Type

float

Example

Rotate a turret yaw toward a target at constant angular speed C++
float TurretYaw = GetActorRotation().Yaw;
float DesiredYaw = (TargetLocation - GetActorLocation()).Rotation().Yaw;
float NewYaw = UKismetMathLibrary::FixedTurn(TurretYaw, DesiredYaw, 90.0f * DeltaTime);
SetActorRotation(FRotator(0.0f, NewYaw, 0.0f));

Tags

Version History

Introduced in: 4.0

Version Status Notes
5.6 stable —

Feedback

Was this helpful?

Suggest an edit

Select a field above to begin editing.