Creating A Melee System With Traces Or Collision

Greetings!

As topic points,it’s about creating a melee system in (preferably) 3rd person view.During my readings on internet I found two solutions for this.

First one is with traces.When player “attacks” an animation plays for “sword swinging”,and at some point animation fires an event to cast traces to check if it hits something.If it hits then with this information user can run required functions for apply damage or for anything else.

45886-a1.jpg

Also if I understood it correct,there is a “Chivaly Medieval Warfare” method,which makes cast traces during the whole swing,not only on a specific time.
Like below:

45887-a3.jpg

[Question]Do these two styles of a single method uses sword’s mesh’s location and and forward vector to cast traces (channel)?

Second one is with collisions.As far as I understand,when your sword’s mesh generates hit event when it touches something that is collideable user can use this to apply damage or run other fuctions,or just ignore like if it is a wall.
When I tried this,problems occured.First my sword (with convex collision shape with max hulls and vertices.) is jsut ignoring stuff and goes throught them.But interestingly it doesn’t ignore player’s (my) collision sphere,and preventing my movement.However I managed to fix this issue with holding sword in right way.And this is where I stucked.

45889-a2.jpg

[Question]What is the proper way to implement a collision based melee system?

Sorry for the long post.I tried to explain the situation and my experiences as I found many helpful answers on here is written in this way.So I wanted to make this topic a kind of reference for future askers.

Thank you!

One problem with the second approach is that if you swing the sword fast enough, in one frame it will be in front of an object and the next frame it will be past it. So no collision will ever be registered. This is why the first approach is gaining popularity. As I understand it, you don’t use the forward vector to project where the line trace goes. In each frame you create a trace between the current position of a socket on the sword and the socket’s position in the previous frame. So in frame t, if the sword went past the object, the object will still intersect with the straight line between the socket’s position in frame t and t-1. Given that point of intersection and the vector direction of that straight line, you can apply a force,impulse, damage … etc. to the object.

Hi there
Could you please showcase on how to achieve this, from my understanding this method is when there are 4 line traces happening from the start to the end of the swing animation and if the line trace intersects it deals damage?