I want to exchange the “Crowd AI Controller” for the “AIController” at runtime.
However, I can’t find any information on how to do this.
Because I have the same problem shown in this post.
I think it is possible to do this because this event exists.
But his solution doesn’t work for me because I don’t want to destroy the pawn… I’m recycling it… I think recycling is more efficient than respawning a new one.
Does anyone know how to swap controllers?
Or failing that, fixing the capsule problem in another way could also be a valid solution for me…
This is my setup for the capsule of the dead. It works fine for clients and server but fails with AI.
I’ll take a look at it.
Although the real problem is not the behavior tree.
The problem is the capsule component.
For some reason the collisions still working even though I disabled them. (for AIs Only)
So when the AI dies its weapon is detached.
And for 5 seconds it is trapped inside the capsule.
Then the other AIs collide with the capsule and they can’t catch the weapon easily.
In the post I attached above, It said that the problem with the capsule is caused by the controller… “Crowd AI Controller”. And if the “AIController” controller is used, this problem does not exist.
Everything would be easier if I could just make the capsule disappear for 5 seconds.
But it does not simulate physics either…
Yes, the problem was definitely with the controller. If I use “AIController” there is no problem with the capsule. I did my own avoidance task using EQS and that way I more or less get the pawns not to collide with each other.
'll use this until a better solution comes along.
So, the difference between AIController and DetourCrowdAIController, is that AIController gets a regular PathFollowingComponent, while DetourCrowdAIController gets a CrowdFollowingComponent.
There are many functions inside CrowdFollowingComponent that you can probably mess around with to enable/disable any functionality in there on the fly.
My guess is that if you SetCrowdSimulationState(ECrowdSimulationState::Disabled) on the corpse’s controller when it dies, it’ll switch to being ignored by the remaining pathfinders, and probably force an update to any of the other pathfinders that are trying to avoid it. I’m not sure about that, as I’ve never actually used it. You might need to call it (or SuspendCrowdSimulation()) on the AIs that you want to be able to go through it now, until it is disappeared.
This is all theory. You might want to have a look at CrowdFollowingComponent.h/.cpp to see what it looks like in there.
I realized this same problem but I hadn’t started looking for a solution yet, since my project is blueprint only and DetourCrowdAIController has absolutely nothing exposed, ZenLeviathan’s solution cannot be used
But what you workaround is perfect.
You just have to spawn a controller and pose the character
OK, no problem!!
I haven’t tried this but you’ve given me an idea…
Maybe dispossessing the pawn while it’s dead and then repossessing it with the same controller will work…
Obviously this would have to be done from the Game Mode…
i will try it!!
Thank you very much!!
yes, I tried that too… the problem was that sometimes the pawn flew very far… sometimes it even went through walls. With the configuration I have now that does not happen.
don’t have you that problem?