RealDocs

UCharacterMovementComponent::PackYawAndPitchTo32

function Engine Since 4.0
#include "GameFramework/CharacterMovementComponent.h"
Access: public Specifiers: static

Description

Compresses a yaw and pitch pair into a single 32-bit value, packing each axis into 16 bits via FRotator::CompressAxisToShort.

Caveats & Gotchas

  • Used internally by saved-move network prediction to shrink control rotation for client-server reconciliation — most gameplay code never needs to call this directly.
  • Lossy: each axis is compressed to 16 bits, so extremely fine rotational precision is not preserved.
  • There's no matching unpack helper on this class; callers must manually shift and mask the returned value to recover the two axes.

Signature

static uint32 PackYawAndPitchTo32(const float Yaw, const float Pitch)

Parameters

Name Type Description Default
Yaw const float Yaw angle in degrees to compress.
Pitch const float Pitch angle in degrees to compress.

Return Type

uint32

Example

Pack control rotation for compact storage C++
const uint32 PackedRotation = UCharacterMovementComponent::PackYawAndPitchTo32(ControlRotation.Yaw, ControlRotation.Pitch);

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.