RealDocs

APawn::CanBeBaseForCharacter

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

Description

Returns whether this pawn can act as a standing surface (movement base) for another pawn or character. Defers to the RootComponent's CanCharacterStepUpOn setting when it is explicitly Yes or No, otherwise falls back to the default AActor behaviour.

Caveats & Gotchas

  • The result depends on the RootComponent's CanCharacterStepUpOn property (ECB_Yes, ECB_No, or ECB_Owner) — if it is set to ECB_Owner, the function calls Super::CanBeBaseForCharacter() which checks the actor's CanCharacterStepUpOn flag.
  • A vehicle or moving pawn that should carry passengers must set its root primitive's CanCharacterStepUpOn to ECB_Yes, otherwise characters will slide off instead of riding it.

Signature

ENGINE_API virtual bool CanBeBaseForCharacter(APawn* APawn) const override;

Parameters

Name Type Description Default
APawn APawn* The pawn that wants to use this actor as a movement base.

Return Type

bool

Example

Make a pawn always walkable as a base C++
// In your pawn's constructor, allow characters to stand on it:
GetRootPrimitiveComponent()->CanCharacterStepUpOn = ECB_Yes;

// Or override the function directly for conditional logic:
bool AMyVehiclePawn::CanBeBaseForCharacter(APawn* OtherPawn) const
{
    return bAllowPassengers;
}

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.