Unity3d Prevent collision missing during fast animations

In Unity 3D, I have a character with a swing animation. I want to detect the exact movement of sword collision so I can stop the swing motion and return to Idle. I am trying to achieve this using several ways.

  • Method 1 - I have a collider & rigid body combination for the sword where I can register onCollision event. ( This is the most accurate but It misses the collision event most of the time since animations are somewhat fast ( even if slows down the animation to 0.3, there are random misses)

  • Method 2 - I am doing raycasting from sword hilt to the end of the blade, If something collides with the blade I register it has hit ( This all has the same problem of method one, but somewhat successful - raycast if done in FixedUpdate function)

  • Method 3 - I have a set of points aligned with the enemy blade and Players’ blade, So In every FixedUpdate event, I calculate the distance between each point, If a distance threshold is reached, I take it as a hit. ( This is the most successful method but this register so many unrealistic hits)

For all 3 methods, I have set proper collision detection for rigid bodies, and fix update time is minimized

So, My question is there a better way to handle collisions during fast animations?

I don’t have an answer to your question, but I am curious what problems the distance threshold method has. I’m working on a game with the same problem, and I have no clue how to set up my sword collisions.

Distance threshold is so far the best method I got, It registers the collision almost always but collisions are not accurate. Most of the time swords are a bit far apart when a collision is registered. Since we are having the same problem I would like to collab with you to solve this. Feel free to reach me via pnudawatta@gmail.com