I’m developing a melee combat system with reallistic collision. I’ve hit a roadblock when looking for a decent method of anticipating a hit in order to stop the sword and avoid penetration.
I know there are many different ways to interpolate sword location between frames and find all collisions. The problem is that they can only detect a hit after the sword has already passed through an object. Even if you correct it instantly the penetration will still be visible for one frame. I know some people use precalculated arcs. It’s sadly impossible in my case. I have only a few ideas on how to fix it.
-
Extrapolation. It kinda works. There are several methods, all have flaws. The ending of animation is especially problematic as the sword speed is quickly reduced. Does anyone know any way to accurately extrapolate such movements?
-
Correct sword position before the frame renders. Is this even possible? Could you update the animation, look for collision, correct it and only then render? Does the engine even allow things like this?
I would be really greatful if anyone could share some thoughts