AI Enemy won't become a ragdoll when shot

Hi there, I’m kind of a novice at this, but I’m trying to make an AI enemy follow the player and become a ragdoll when a bullet collides with it (this is using just using preset First Person and Third Person assets btw). My problem is that the AI enemy doesn’t become a ragdoll when shot, so does anyone know what’s up with that?

Blueprint for AI enemy:



Tagged from BP_FirstPersonProjectile:
image

Few things you can check through…

1. Check Collision Setup

Ensure that the collision settings on both the bullet and the AI enemy are configured correctly:

  • The bullet should have a collision preset that enables it to trigger overlap or hit events. Typically, this would be set to “Projectile”.
  • The AI enemy should have collision enabled and properly set to detect collisions with projectiles.

2. Blueprint Logic Check

From your blueprint screenshots, it seems like you have the following setup:

  • On Component Hit: This event is triggered when something hits the mesh component of the AI.
  • Actor Has Tag “Bullet”: Correctly checks if the colliding actor is tagged as “Bullet”.
  • Ragdoll Custom Event: This should correctly execute the ragdoll logic.

Ensure that the Mesh component of the AI enemy is set up to generate hit events. This is a checkbox in the details panel of the mesh component.

3. Ragdoll Implementation

Your ragdoll setup involves:

  • Disabling collision on the primary mesh component.
  • Enabling simulation of physics.
  • Optionally, setting a physics blend weight if you are blending between animated and ragdoll states.

Here are some specific things to check:

  • Is Alive Check: Before turning the ragdoll physics on, ensure that your condition “Is Alive?” is properly updated elsewhere in your blueprint. If this condition is not set correctly, the ragdoll logic won’t execute.
  • Collision and Physics Settings: When you set collision to none and enable physics simulation, ensure that the mesh has a proper physics asset associated with it. Without a physics asset, the mesh won’t behave as a ragdoll.

4. Debugging Tips

  • Print Statements: Use print statements to confirm if the hit event is detected and if the bullet is correctly identified.
  • Visual Debugging: Place breakpoints in the Unreal Editor on nodes inside your event graph to see if they are being executed when a hit occurs.

5. Component vs. Actor

Ensure that the collision event is connected to the correct component. If your AI has multiple components (like additional meshes or collision components), the bullet might be hitting a different component that doesn’t have the hit event set up.

6. Check the Bullet Blueprint

Ensure that the bullet itself is correctly set up to interact with the AI:

  • It should have a proper collision component, typically a sphere or capsule component, that detects collisions.
  • Make sure that the bullet’s movement doesn’t disable collision checks or bypasses them somehow.

Hope this helps.