UCharacterMovementComponent::GetGravityZ
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtualconstoverride
Description
Returns the effective world gravity's Z component scaled by this component's GravityScale.
Caveats & Gotchas
- • Multiplies UMovementComponent::GetGravityZ() (which reads world/PhysicsVolume gravity) by GravityScale, so setting GravityScale to 0 disables gravity for this component without touching world gravity.
- • Negative values are the norm — base gravity points down, so a GravityScale greater than 1 makes gravity stronger, not reversed.
Signature
virtual float GetGravityZ() const override Return Type
float Example
Computing jump apex time C++
float UMyCharacterMovementComponent::GetTimeToJumpApex() const
{
return -JumpZVelocity / GetGravityZ();
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?