UCharacterMovementComponent::StepUp
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtual
Description
Attempts to move the character up and over a step or shallow slope after a blocking hit. Does nothing and returns false if CanStepUp(Hit) returns false or MaxStepHeight is zero or less.
Caveats & Gotchas
- • Silently no-ops and returns false if MaxStepHeight <= 0, even when CanStepUp(Hit) would otherwise allow it.
- • This is a low-level physics helper called internally during PhysWalking(); calling it directly outside the normal movement pipeline can leave CurrentFloor and the movement base out of sync.
Signature
virtual bool StepUp(const FVector& GravDir, const FVector& Delta, const FHitResult &Hit, FStepDownResult* OutStepDownResult = NULL) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| GravDir | const FVector& | Gravity vector direction, assumed normalized or zero. | — |
| Delta | const FVector& | Requested move. | — |
| Hit | const FHitResult& | The blocking hit encountered before the step up. | — |
| OutStepDownResult | FStepDownResult* | If non-null, receives the result of a floor check performed as part of the final step down. | NULL |
Return Type
bool Example
Custom ground physics calling StepUp C++
void UMyCharacterMovementComponent::PhysCustom(float deltaTime, int32 Iterations)
{
FHitResult Hit;
SafeMoveUpdatedComponent(MoveDelta, UpdatedComponent->GetComponentQuat(), true, Hit);
if (Hit.bBlockingHit && CanStepUp(Hit))
{
FStepDownResult StepDownResult;
StepUp(-FVector::UpVector, MoveDelta, Hit, &StepDownResult);
}
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?