APawn custom AIController, and UCrowdFollowingComponent c++ setup for Detour/CrowdManager

Hi !
So after 2 weeks of tweaking, searching and debugging unreal source code finally found a way to implement Detour/CrowdManager for simple APawn with FloatingPawnMovement component.

Im writing this cause there is no such tutorial/information on the forum and elsewhere.

Mine APawn Setup
image

AIController custom derived class:
image
As you can see there is PathFollowingComponent.

First step to setup it properly is to create custom AIControllerClass derived from AIController.h - this neccessary because we will need to write custom constructor

Second step is to create custom FollowingComponent derived from UCrowdFollowingComponent , why ?


because of this, engine implementation does not allow for avoidance groups, and pawns are not avoiding each other

Then in custom FollowingComponent, in my example UEnemyCrowdFollowingComponent override this properties


This is default implementation, if you need other groups you need to override this different etc…

Okay now lets go back to AIController class, in my example AEnemyController


implement constructor such like this, and then in implementation:

You may need to recreate or reparent AIController blueprint due to data corruption

Ok giong back to editor create Blueprint class of custom AIController in my example AEnemyController, instance and open it


Check ComponentClass to custom implementation of UCrowdFollowingComponent

Then in custom AIController you can set properties of AgentData passed to CrowdManager


Also, ->SetAvoidanceGroup(1) is not working unless coupled with CharacterMovementComponent so, this is why this workaroung needed if you want to implement custom APawn Detour controller

Cheers,
If this post helped you, consider donating to animal shelter !

1 Like

This helped me out a ton. Thanks!