AActor::GetVelocity
#include "GameFramework/Actor.h"
Access: public
Specifiers: virtualconstUFUNCTIONBlueprintCallable
Description
Returns the velocity of the actor in cm/s. For actors with a physics root component, returns the physics linear velocity; for pawns, UCharacterMovementComponent overrides this to return the movement component's velocity.
Caveats & Gotchas
- • Returns FVector::ZeroVector for actors that are neither simulating physics nor have a movement component — it does not automatically compute velocity from position delta.
- • Characters override this via UCharacterMovementComponent::GetVelocity(), so the returned vector is the movement component's velocity, not the raw physics body velocity. These can differ when the character is being pushed by physics.
Signature
ENGINE_API virtual FVector GetVelocity() const Return Type
FVector Examples
Detect whether the actor is moving and print a message
Blueprint
Check if actor is moving C++
FVector Vel = GetVelocity();
if (Vel.SizeSquared() > FMath::Square(10.f))
{
// Actor is moving
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?