RealDocs

APawn::IsBasedOnActor

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

Description

Returns true if this pawn is standing on, attached to, or otherwise based on the given actor. Overrides the AActor version to also check the movement base component returned by GetMovementBase().

Caveats & Gotchas

  • The base APawn always returns nullptr from GetMovementBase(), so for base APawn this check will fall back to the attachment chain only — subclasses like ACharacter override GetMovementBase() and will check the capsule's floor contact.
  • Passing null for Other will return false — the function does not special-case null to mean 'based on anything'; use GetMovementBase() != nullptr to test that check.

Signature

ENGINE_API virtual bool IsBasedOnActor(const AActor* Other) const override;

Parameters

Name Type Description Default
Other const AActor* The actor to test as a movement base.

Return Type

bool

Example

Prevent two pawns from stacking on the same platform C++
for (APawn* OtherPawn : PawnsOnPlatform)
{
    if (OtherPawn->IsBasedOnActor(Platform))
    {
        // This pawn is standing on the platform
        OtherPawn->Jump();
    }
}

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.