UCharacterMovementComponent::GetGravityDirection
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintPure
Description
Returns the current normalized gravity direction used by the movement simulation.
Caveats & Gotchas
- • Defaults to DefaultGravityDirection (straight down) until SetGravityDirection() has been called at least once.
- • This is a direction, not a magnitude — pair it with GetGravityZ() if you need the actual gravity strength.
Signature
FVector GetGravityDirection() const Return Type
FVector Example
Orient a character mesh to gravity C++
const FVector Down = GetCharacterMovement()->GetGravityDirection();
const FQuat TargetRot = FQuat::FindBetweenNormals(-FVector::UpVector, Down); See Also
Tags
Version History
Introduced in: 5.4
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?