UCharacterMovementComponent::SetBase
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: virtual
Description
Updates the PrimitiveComponent the character is currently standing on, used for relative movement and move-with-base behavior.
Caveats & Gotchas
- • Passing a moving or rotating base causes the character to move with it on subsequent ticks via MovementBaseUtility; a static, non-simulating component with bGenerateOverlapEvents off is cheapest.
- • Setting a new base does not itself move the character to the base's surface — it only establishes the relative-tracking relationship. Call SetBaseFromFloor() if you also want floor-relative positioning.
- • Basing on a component that gets destroyed without clearing the base first can leave stale weak pointers around until the next tick clears them.
Signature
virtual void SetBase(UPrimitiveComponent* NewBase, const FName BoneName = NAME_None, bool bNotifyActor=true) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| NewBase | UPrimitiveComponent* | The primitive component the character should be considered standing on. Pass null to clear the base. | — |
| BoneName | const FName | Optional bone name on a skeletal mesh base to attach relative to. | NAME_None |
| bNotifyActor | bool | Whether to notify the owning actor's base-change events. | true |
Return Type
void Example
Manually clearing the movement base C++
void AMyCharacter::DetachFromMovingPlatform()
{
UCharacterMovementComponent* MoveComp = GetCharacterMovement();
MoveComp->SetBase(nullptr);
} Tags
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?