Weird Problem with AI

I’m new to unreal engine and building AI so bare with me.

The AI character in my game runs towards the player. Once the player shoots the AI,

In my player controlled character’s blueprint:

  • I use the function “Set Simulate Physics” with the target being the AI character’s mesh.
  • I then use “Add Impulse at Location”

This works greats.

Problem is it seems that there’s something left behind. The mesh will get knocked around but some sort of invisible capsule still stays where the AI character was shot and I have to use “Detatch from Controller Pending Destroy” or else that invisible capsule is still running towards me.

I believe that invisible part is the AI controller. There’s another thing called the capsule component which could also be the culprit.

Is the AI controller what I want to get rid of? If so, how? I tried using “DestroyComponent” but to no avail. I could use “DestroyActor” but that gets rid of the mesh too.

So again, my goal is that I want the mesh to stay for a bit so I can see the ragdoll effects but I want to get rid of everything else.

This is exactly the problem I’m having:

I tried using Get AIController -> Un Possess -> DestroyActor but it’s not working either.

Hi.

Console - View Collisions.
You should see your enemy capsule still walking around…

Destroy the AI and also destroy the capsule component of the dead character.

The behavior tree executes the following code when the AI is shot.
First it destroys the capsule:
Cast to AIController -> GetControlledPawn -> Cast To Character -> Destroy Component (Capsule Component of Character)
Then it destroys the AIController:
GetAIController -> DestroyActor -> Finish Execute

Still nothing, I debugged and verified that it’s going through all those steps.

You could bind to the OnDestroyed? delegate of the character in the controller when you begin play on it (i.e. call GetPawn from the controller, then bind the delegate so you know the thing you were controlling is now dead). Then call Destroy on self when the delegate gets called, because the character you were controlling just died.

To make sure the controller uses the same position as the pawn its controlling, there’s a checkbox on the controller you need to check. Can’t remember the name, something like “follows pawn” or some such.

Thanks zoombapup, once I was able to see the collisions I found out the problem was the capsule controller wasn’t being destroyed. I still couldn’t figure out how to destroy it (destroy component didn’t work) but I was able to disable collisions for it instead which is good enough.

I actually used the same solution with disabling the collision of the capsule. It seems like a serviceable solution, but it would feel cleaner to me if the mesh remained as a ragdoll and the capsule was destroyed. Anybody know how that would work?