UCharacterMovementComponent::CalcVelocity
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallablevirtual
Description
Updates Velocity and Acceleration for the current tick by applying friction and acceleration or deceleration. Does not apply gravity.
Caveats & Gotchas
- • Called internally every physics substep during normal movement — you don't need to call this yourself unless implementing a custom movement mode inside PhysCustom().
- • Does nothing if HasAnimRootMotion() is true, DeltaTime is below MIN_TICK_TIME, or the component is a SimulatedProxy not currently simulating root motion, since velocity comes from elsewhere in those cases.
Signature
virtual void CalcVelocity(float DeltaTime, float Friction, bool bFluid, float BrakingDeceleration) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| DeltaTime | float | Time elapsed since the last frame. | — |
| Friction | float | Coefficient of friction applied when not accelerating, or opposite the acceleration direction. | — |
| bFluid | bool | If true, friction is always applied regardless of acceleration (used for fluid-like movement). | — |
| BrakingDeceleration | float | Deceleration applied when not accelerating, or when exceeding max speed. | — |
Return Type
void Example
Drive velocity in a custom movement mode C++
void UMyMovementComponent::PhysCustom(float DeltaTime, int32 Iterations)
{
CalcVelocity(DeltaTime, GroundFriction, false, GetMaxBrakingDeceleration());
// ... continue with custom position integration
} See Also
Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?