Hey, I have created 2 classes. One which derives from AIController and one which derives from ACharacter.
On the AIController I spawn the ACharacter in the BeginPlay function and posses it to the controller:
I have nav mesh on the editor and weird think happens.
I set a target position which the character suppose to get there by SimpleMoveToLocation and where it interacts with the cube the character stops moving:
Well, It changed it all. Now the ACharacter creates the controller and the character spawns from the playercontroller (with FVector(x,y,z)).
On the constructor of the character I have added this:
How do you spawn the AI controllers? I’m asking because what you described is in opposite to what we usually do. Usually you create a Character class and set its AIControllerClass to your AI controller class, and then just spawn characters and the controller gets spawned automatically.
Would you mind sharing some more information in this regard?
I’m not sure - I’ve never seen anyone doing it this way
However, since you’re using C++, I suggest checking what FVector() really does. You basically create an AIController in an unidentified “somewhere”.
Please try spawning characters first and rely on internal UE4 mechanics to spawn AI controllers for them.
Also, make sure your characters’ AutoPossessPlayer is set to Disabled - otherwise the way you set up things will result in a pawn auto-possessed by player controller.
By default only manually-placed characters get default controller to spawn. But you can change that by setting Pawn.AutoPossessAI to PlacedInWorldOrSpawned. Or you can manually call SpawnDefaultController on your characters after spawning.
Have you tried debugging it in any way? Putting breakpoints, validating parameters, looking at return values. Have you tried looking at it with Log Visualizer? If not I highly encourage you to do so, and regarding Log Visualizer, there should be enough info on the internet (especially this site and the forum) to get you going.
I have needed the character to know about each other because I had the SimpleMoveToLocation function and I have wanted the characters not to collision each other but to pass each other. So I have added this.
When I changes it to that:
Well, you can use RVO, which you enable with bUseRVOAvoidance flag you your AI’s character movement component. Mind however that RVO doesn’t care about navmesh, so you may run into issues if AI staying o navmesh is important to you.
Having staid that, it should all work with UCrowdFollowingComponent you had set up before. Would you mind supplying us with a stripped-down version of your project so that we can investigate the issue? Feel free to send it o me at mieszko.zielinski@epicgames.com.
Found it. You’ve used SimpleMoveToLocation which apparently does not work with CrowdFollowingComponent (which is a bug of course and I’ve just filed it as a such). It all works fine if you use AAIController::MoveToLocation instead.
Actually it is not. Now the bug is not exist any more but when I try to move the character in a path which blocked by another character it acting weird.
In addition the character always looks at the target and not in the direction of his path. Is there a way to fix it? And when will Epic fix the bug?