RealDocs

APawn::GetVelocity

function Engine Since 4.0
#include "GameFramework/Pawn.h"
Access: public Specifiers: virtualoverride

Description

Returns the pawn's current velocity vector in world space. Overrides AActor::GetVelocity() to query the movement component when available, falling back to the root component's physics velocity.

Caveats & Gotchas

  • If the pawn has a UPawnMovementComponent, the velocity is read from that component's Velocity property — it is not derived from the root component's physics state, so they may differ if you manipulate physics directly.
  • On simulated proxy clients the velocity is replicated via PostNetReceiveVelocity(), so there may be a small lag compared to the server authoritative value; for smooth visuals, use the movement component's replicated velocity or interpolate.

Signature

ENGINE_API virtual FVector GetVelocity() const override;

Return Type

FVector

Example

Check if the pawn is moving C++
FVector Vel = GetVelocity();
if (Vel.SizeSquared() > FMath::Square(10.f))
{
    // Pawn is moving — play footstep audio, etc.
}

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.