UCharacterMovementComponent::SetAvoidanceEnabled
#include "GameFramework/CharacterMovementComponent.h"
Access: public
Specifiers: UFUNCTIONBlueprintCallable
Description
Enables or disables RVO avoidance for this character, registering or unregistering it with the avoidance manager as needed.
Caveats & Gotchas
- • Marked UnsafeDuringActorConstruction — calling it from a constructor can fail silently because the avoidance manager isn't ready yet; call it from BeginPlay instead.
- • Registration requires a valid AvoidanceUID; if the character was never assigned one, enabling avoidance has no effect.
Signature
void SetAvoidanceEnabled(bool bEnable) Parameters
| Name | Type | Description | Default |
|---|---|---|---|
| bEnable | bool | Whether RVO avoidance should be enabled for this character. | — |
Return Type
void Example
Enable avoidance at BeginPlay C++
void AMyCharacter::BeginPlay()
{
Super::BeginPlay();
GetCharacterMovement()->SetAvoidanceEnabled(true);
} See Also
Version History
Introduced in: 4.0
| Version | Status | Notes |
|---|---|---|
| 5.6 | stable | — |
Feedback
Was this helpful?