Here is how I set up my Alien to damage the player with a simple capsule collider.
-
I first created a new Socket in the Spider Skeleton on the leg/limb that will be used in the animation (in my case - Left Leg)
-
I’ve added a new Capsule Collider to the BP_Alien and parented it to the new socket (Scaled it a bit to cover more of the limb)
-
In the Animation Montage, I’ve added two events - one to enable the collider + another one to disable the collider. Enable Collider is positioned right before the Limb/weapon begins to strike.
Disable Collider is positioned right after it finishes the attack.
-
In the BP_Alien, I’ve created two functions: “Activate Weapon” and “Deactivate Weapon.” They will be used with the events from our Animation Montage. To achieve this, I’ve used the “Set Collision Enabled” node like this
Activate Weapon
Deactivate Weapon
AnimBP_Alien Weapon Event Functions
-
Then, in the BP_Alien > Event Graph - I’ve added the “On Component Begin Overlap” Event for the weapon collider and added the “Apply Damage” function
-
To make sure the weapon is disabled when we begin the game, I’ve also added “Deactive Weapon” to “Event Begin Play” like this
To test this, you can add Prints to all the new nodes/functions and test if they work as intended. Hopefully, if I didn’t forget or miss anything😅, your Alien should damage you ONLY if it’s weapon collider hit’s the player’s collider.