Hit Detection Challenges | Thomas Claiborne | 02/21/2025


The Problem:

After successfully implementing a basic combo system using an array of animation sequences, my next task was to create hit detection for our action RPG's combat. While the character could perform attack animations, they were purely visual - there was no way to actually damage enemies or interact with the game world. Initial research led me to using Animation Notify States, which seemed perfect: they could define hit detection windows during attacks and trigger sphere traces from specific bones (like fists during a punch).

However, I quickly hit a wall. Many of our combat animations contained multiple strikes in a single sequence, but the basic Notify State approach only supported tracking one bone's collision per animation. This meant we couldn't properly detect hits for complex martial arts combinations where multiple limbs were striking at different times. For a combat-focused game, having attacks that visually connect but don't register damage would severely undermine the player experience.

The Solution: 

The breakthrough came when I discovered Unreal's Data Assets. Instead of trying to force multiple hit detections into a single Notify State, I created a structured data system to track everything about an attack sequence.




I designed two key structures:

  • BoneTimingData: Stores a bone name and its specific hit detection window (start/end times)
  • ComboAttackData: Combines an animation sequence with an array of BoneTimingData for all striking bones

 

This allowed me to create a Data Asset that stores an entire combo sequence along with precise hit detection timing for every strike. But I wasn't done yet - I noticed that hit detection spheres were still spawning after a successful hit, potentially registering multiple hits for a single strike. To solve this, I added a hit registration flag to BoneTimingData that disables further detection once a strike connects, resetting only when the animation completes.

The new system had an unexpected benefit beyond fixing hit detection. We could now replace our original hardcoded animation array system with ComboDataAssets, making it much easier to create and test different combo sequences. What started as a hit detection problem led to a more robust and maintainable combat framework that accurately tracks every strike in our most complex combinations.

The end result is a combat system that not only looks good but feels precise and responsive, with hit detection that perfectly matches the visual feedback players see on screen.


Get Ascension Zero

Leave a comment

Log in with itch.io to leave a comment.