AI Collision and Decorator behavior problems
Author: Jordan Rarrat
Posted on: 06/13/2025
Part 1: The Problem
This week I ran into a critical issue with our enemy AI’s melee attack system. I had set up a collision box on the enemy character meant to detect when the player enters melee range. However, during gameplay, the OnComponentBeginOverlap
event was never triggered, which meant enemies were unable to detect the player for attacks. This was a major problem because without the ability to detect the player in close range, enemies just stood there even during attack animations.
Part 2: The Solution
After debugging the issue and verifying that the collision box was being set up correctly in C++, I realized that while the component existed, it was not correctly attached or visible in the Blueprint version of the enemy on the map. I adjusted the SetupAttachment()
in the constructor and enabled overlap events by setting the collision mode to ECollisionEnabled::QueryOnly
and using SetCollisionResponseToAllChannels(ECR_Overlap)
. I also made sure that SetGenerateOverlapEvents(true)
was called and that the delegate was bound to a UFUNCTION()
to avoid runtime binding errors. Once these were in place, the collision began firing as expected. Now the enemy can detect when the player enters the attack box and trigger damage logic properly.
Zombats
Third-person Ability Shooter
Status | In development |
Authors | Wombat Studios, JRarrat, Josh The Dark, iWannaNuhh, aabunada, Flynn Studios |
Genre | Action |
Tags | 3D, Third-Person Shooter, Zombies |
More posts
- Camera Collision against Walls3 days ago
- Putting the DUH in HUD3 days ago
- Input, Sounds, Guns and Collision - Ben Bissett3 days ago
- The Journey to Multiplayer - Joshua Newton3 days ago
Leave a comment
Log in with itch.io to leave a comment.