# Why "RVO Avoidance" does not work when pawn is cotrolled by AAIController?

**URL:** <https://forums.unrealengine.com/t/why-rvo-avoidance-does-not-work-when-pawn-is-cotrolled-by-aaicontroller/1818487>\
**Category:** AI\
**Tags:** npc, unreal-engine, avoidance, question, CPP\
**Created:** [April 24, 2024, 6:00am UTC](https://forums.unrealengine.com/t/why-rvo-avoidance-does-not-work-when-pawn-is-cotrolled-by-aaicontroller/1818487 "2024-04-24T06:00:36Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [April 24, 2024, 6:00am UTC](https://forums.unrealengine.com/t/why-rvo-avoidance-does-not-work-when-pawn-is-cotrolled-by-aaicontroller/1818487/1 "2024-04-24T06:00:36Z")

</div>

When i use RVO Avoidance in a pawn controlled by an APlayerController it does work well… is impossible touch other pawn…

But when i use RVO Avoidance in a pawn controlled by an AAIController it seem does not work… My NPCs can touch each other without problems.

What i need is exactly the opposite behaviour.

This is the only setting i modified (UCharacterMovement):

```auto
	if (Controller->IsA<AAIController>())
	{
		bUseRVOAvoidance = true;
		AvoidanceConsiderationRadius = 1000.f;
		AvoidanceWeight = 0.5f;
		SetAvoidanceEnabled(true);		
	}

```

Why this happen?  
I need to do something else?

Thank you so much!!

* * *

Edited:

* * *

And this happen if i try to inherit from ADetourCrowdAIController (UE5.4)

```auto
0>Module.Catharsis.8.cpp.obj: Error : LNK2019: símbolo externo "private: static class UClass * __cdecl ADetourCrowdAIController::GetPrivateStaticClass(void)" (?GetPrivateStaticClass@ADetourCrowdAIController@@CAPEAVUClass@@XZ) sin resolver al que se hace referencia en la función "public: static class UClass *__cdecl ADetourCrowdAIController::StaticClass(void)" (?StaticClass@ADetourCrowdAIController@@SAPEAVUClass@@XZ)
0>Module.Catharsis.8.cpp.obj: Error : LNK2019: símbolo externo "public: __cdecl ADetourCrowdAIController::ADetourCrowdAIController(class FVTableHelper &)" (??0ADetourCrowdAIController@@QEAA@AEAVFVTableHelper@@@Z) sin resolver al que se hace referencia en la función "class UObject *__cdecl InternalVTableHelperCtorCaller<class ATheAIControllerBase>(class FVTableHelper &)" (??$InternalVTableHelperCtorCaller@VATheAIControllerBase@@@@YAPEAVUObject@@AEAVFVTableHelper@@@Z)
0>Module.Catharsis.8.cpp.obj: Error : LNK2019: símbolo externo "public: virtual __cdecl ADetourCrowdAIController::~ADetourCrowdAIController(void)" (??1ADetourCrowdAIController@@UEAA@XZ) sin resolver al que se hace referencia en la función "public: virtual__cdecl ATheAIControllerBase::~ATheAIControllerBase(void)" (??1ATheAIControllerBase@@UEAA@XZ)
0>TheAIControllerBase.cpp.obj: Error : LNK2019: símbolo externo "public: __cdecl ADetourCrowdAIController::ADetourCrowdAIController(class FObjectInitializer const &)" (??0ADetourCrowdAIController@@QEAA@AEBVFObjectInitializer@@@Z) sin resolver al que se hace referencia en la función "public:__cdecl ATheAIControllerBase::ATheAIControllerBase(class FObjectInitializer const &)" (??0ATheAIControllerBase@@QEAA@AEBVFObjectInitializer@@@Z)

```

I’m sure i have the AIModule:

> **[ADetourCrowdAIController](https://dev.epicgames.com/documentation/en-us/unreal-engine/API/Runtime/AIModule/ADetourCrowdAIController?application_version=5.4)**

Anyway i think i don’t need it… i think RVO Avoidance can be enough.

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [April 28, 2024, 11:44am UTC](https://forums.unrealengine.com/t/why-rvo-avoidance-does-not-work-when-pawn-is-cotrolled-by-aaicontroller/1818487/2 "2024-04-28T11:44:44Z")

</div>

Bump the post:

I wrote my own avoidance algorithm and more or less works in my specific case.  
But I would like to use Epic’s RVOAvoidance because it sure is better.

So this post is not dead… As long as RVO doesn’t work for me.

Thank you so much!!

---

<div class="post-metadata">

**Author:** ![chrudimer](https://d1ap1mz92jnks1.cloudfront.net/user_avatar/forums.unrealengine.com/chrudimer/32/918651_2.png) [@chrudimer](https://forums.unrealengine.com/u/chrudimer)\
**Post date:** [April 28, 2024, 3:45pm UTC](https://forums.unrealengine.com/t/why-rvo-avoidance-does-not-work-when-pawn-is-cotrolled-by-aaicontroller/1818487/3 "2024-04-28T15:45:26Z")

</div>

Hi, I haven’t setup RVO avoidance from c++, but in the character movement settings in blueprint (see e.g. step 4 here [Using Avoidance With the Navigation System in Unreal Engine](https://dev.epicgames.com/documentation/en-us/unreal-engine/using-avoidance-with-the-navigation-system-in-unreal-engine?application_version=5.3)), did you try it with those settings?

And for crowd avoidance, you would need to set it to use the UCrowdFollowingComponent instead of the default path following component in your AIController (don’t know why its like that instead of inheriting), post #3 here [Missing DetourCrowdAIController in C++ - #3 by chrudimer](https://forums.unrealengine.com/t/missing-detourcrowdaicontroller-in-c/474481/3)

---

<div class="post-metadata">

**Author:** ![Ivan3z](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Ivan3z](https://forums.unrealengine.com/u/Ivan3z)\
**Post date:** [April 28, 2024, 10:19pm UTC](https://forums.unrealengine.com/t/why-rvo-avoidance-does-not-work-when-pawn-is-cotrolled-by-aaicontroller/1818487/4 "2024-04-28T22:19:12Z")

</div>

Hi @chrudimer

> [@chrudimer](#):
>
> Hi, I haven’t setup RVO avoidance from c++, but in the character movement settings in blueprint (see e.g. step 4 here [Using Avoidance With the Navigation System in Unreal Engine](https://dev.epicgames.com/documentation/en-us/unreal-engine/using-avoidance-with-the-navigation-system-in-unreal-engine?application_version=5.3)), did you try it with those settings?

Yes, I did it as in the guide… but I didn’t see any difference. Pawns can touch each other.

> [@chrudimer](#):
>
> And for crowd avoidance, you would need to set it to use the UCrowdFollowingComponent instead of the default path following component in your AIController (don’t know why its like that instead of inheriting), post #3 here [Missing DetourCrowdAIController in C++ - #3 by chrudimer](https://forums.unrealengine.com/t/missing-detourcrowdaicontroller-in-c/474481/3)

I also did it as you explain in your comment.

```auto
ABaseAIControllerCPP::ABaseAIControllerCPP(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("PathFollowingComponent"))) {}

```

And I disabled RVOAvoidance too (I know that only one of the two can be used at the same time). But the same thing happens. The pawns can touch each other.

So I think. if it works for everyone else, and it doesn’t work for me. So there must be something in my code that prevents it from working.

Maybe it’s because I have a custom CharacterMovemrntComponent. But it’s strange because I use the same CharacterMovemrntComponent for the player and for the NPCs and RVOAvoidance works for the players but it doesn’t work for NPCs…

I’ll have to look into it. I suspect there is something I haven’t configured correctly to work.

Thank you very much for your help @chrudimer
