UCharacterMovementComponent::GetDeltaRotation
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualconst
Description
Returns how far the character should rotate over the given time interval, based on RotationRate.
Caveats & Gotchas
- • Default implementation simply scales RotationRate by DeltaTime — it doesn't account for acceleration or current facing direction; that logic lives in ComputeOrientToMovementRotation() and PhysicsRotation().
- • Called every physics substep from PhysicsRotation(), so an expensive override here has a direct, multiplied cost on movement performance.
- • Overriding this is a common way to implement non-linear turn rates (e.g. faster turning at low speed) without touching PhysicsRotation() itself.
Signature
virtual FRotator GetDeltaRotation(float DeltaTime) const; Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DeltaTime | float | Time slice to compute the rotation delta for. | — |
Return Type
FRotator Example
Speed-dependent turn rate override C++
FRotator UMyCharacterMovementComponent::GetDeltaRotation(float DeltaTime) const
{
const float SpeedFactor = FMath::Clamp(Velocity.Size() / MaxWalkSpeed, 0.25f, 1.f);
return RotationRate * SpeedFactor * DeltaTime;
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?