RealDocs

UCharacterMovementComponent::GetPathFollowingBrakingDistance

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

Description

Returns the distance before the path-following destination at which the path follower should start braking, so the character comes to a stop at the goal instead of overshooting it.

Caveats & Gotchas

  • Overrides UNavMovementComponent::GetPathFollowingBrakingDistance() and, by default, derives the distance from deceleration and braking-friction settings rather than a fixed value.
  • Only affects AI-driven movement through UPathFollowingComponent; it has no influence on player-controlled or root-motion-driven movement.
  • Returning too small a value causes AI characters to visibly overshoot waypoints; returning too large a value makes them slow down unnecessarily early.

Signature

virtual float GetPathFollowingBrakingDistance(float MaxSpeed) const override

Parameters

Name Type Description Default
MaxSpeed float The maximum speed the character is currently moving at along the path.

Return Type

float

Example

Fixed braking distance for a slower-turning character C++
float UMyCharacterMovementComponent::GetPathFollowingBrakingDistance(float MaxSpeed) const
{
	// This character type needs extra room to brake smoothly.
	return Super::GetPathFollowingBrakingDistance(MaxSpeed) * 1.5f;
}

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.