# Can't create custom Detour Crowds AI controller in 4.12?

**URL:** <https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981>\
**Category:** AI\
**Tags:** ai-navigation, issues, aicontroller, detour-crowds, unreal-engine, question\
**Created:** [July 5, 2016, 8:11am UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981 "2016-07-05T08:11:03Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![CyberblastSoft](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CyberblastSoft](https://forums.unrealengine.com/u/CyberblastSoft)\
**Post date:** [July 5, 2016, 8:11am UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/1 "2016-07-05T08:11:03Z")

</div>

hey all! I am confused that i cant seem to be able to get the detour crowds ai controller to work. Here are the files for the custom controller class.

implementation of the controller class

```
#include "ProjectPastry.h"
#include "AIModule.h"
#include "Navigation/CrowdFollowingComponent.h"
#include "BaseAIController.h"

ABaseAIController::ABaseAIController(const FObjectInitializer& ObjectInitializer)
	: Super(ObjectInitializer.SetDefaultSubobjectClass<UCrowdFollowingComponent>(TEXT("CrowdFollowingComponent")))
{
	AIPerception = CreateDefaultSubobject<UAIPerceptionComponent>(TEXT("AIPerception"));
}

```

header file

```
#pragma once

#include "AIController.h"
#include "Perception/AIPerceptionComponent.h"
#include "BaseAIController.generated.h"

/**
 * 
 */
UCLASS()
class PROJECTPASTRY_API ABaseAIController : public AAIController
{
	GENERATED_BODY()

public:
	ABaseAIController(const FObjectInitializer& ObjectInitializer = FObjectInitializer::Get());

	UPROPERTY(VisibleAnywhere, BlueprintReadWrite, Category = Sense)
	UAIPerceptionComponent* AIPerception;

};

```

in the BP class that inherits from this class just shows the default pathfollowingcomponent which tells me that this does not work.

 ![97166-trouble.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/5/f/2/5f2de07f045883b1e8a515e21d5d0691392b924a.png)

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0350c162](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0350c162](https://forums.unrealengine.com/u/anonymous_user_0350c162)\
**Post date:** [January 8, 2017, 3:45pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/2 "2017-01-08T15:45:23Z")

</div>

I am also curious about that. Did you find any type of workaround to that problem?

I’m trying to implement a custom avoidance algorithm on top of the existing detour crowd navigation because its not avoiding other type of characters, such as the player. I’m working on a VR-application where it is pretty important that ai agents dont get stuck on the player.

Hope you can find the time to respond…

Cheers

---

<div class="post-metadata">

**Author:** ![CyberblastSoft](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CyberblastSoft](https://forums.unrealengine.com/u/CyberblastSoft)\
**Post date:** [January 8, 2017, 3:51pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/3 "2017-01-08T15:51:35Z")

</div>

I’m pretty sure you don’t use the FObjectInitializer any longer, I think you can now just create default subject on it

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_630f0a79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_630f0a79](https://forums.unrealengine.com/u/anonymous_user_630f0a79)\
**Post date:** [January 8, 2017, 5:07pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/4 "2017-01-08T17:07:07Z")

</div>

Tied to get game twin stick shooter to work error massage lost or missing modular must be made with  
different engine

---

<div class="post-metadata">

**Author:** ![CyberblastSoft](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@CyberblastSoft](https://forums.unrealengine.com/u/CyberblastSoft)\
**Post date:** [January 8, 2017, 5:08pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/5 "2017-01-08T17:08:57Z")

</div>

In your build.cs, you need to include AIModule in the dependancies

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_630f0a79](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_630f0a79](https://forums.unrealengine.com/u/anonymous_user_630f0a79)\
**Post date:** [January 8, 2017, 5:34pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/6 "2017-01-08T17:34:07Z")

</div>

try to make game twin stick shooter got error message methanol  
lost modules may be another engine

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0350c162](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0350c162](https://forums.unrealengine.com/u/anonymous_user_0350c162)\
**Post date:** [January 8, 2017, 6:13pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/7 "2017-01-08T18:13:20Z")

</div>

I’m new to UE4 C++. How do I create default subobjects other than using FObjectinitializer?

---

<div class="post-metadata">

**Author:** ![anonymous\_user\_0350c162](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@anonymous\_user\_0350c162](https://forums.unrealengine.com/u/anonymous_user_0350c162)\
**Post date:** [January 8, 2017, 6:21pm UTC](https://forums.unrealengine.com/t/cant-create-custom-detour-crowds-ai-controller-in-4-12/362981/8 "2017-01-08T18:21:32Z")

</div>

Just answered my own question by looking at the [docs](https://docs.unrealengine.com/latest/INT/Programming/UnrealArchitecture/Reference/Classes/#classconstructor):

```
// Constructor Body   
// Create a new component and give it a name.
    WindPointSource = CreateDefaultSubobject<UWindPointSourceComponent>(TEXT("WindPointSourceComponent0"));

    // Set our new component as the RootComponent of this actor, or attach it to the root if one already exists.
    if (RootComponent == nullptr)
    {
        RootComponent = WindPointSource;
    }
    else
    {
        WindPointSource->AttachTo(RootComponent);
    }

```
