How can you make a line trace follow an object?

Hello i would like to achieve a melee system similar to chivalry.
The problem is i can’t find how to make line traces that follow the sword during the animation.
Here is an example of what i am trying to achieve.

Any help is appreciated :slight_smile:

1 Like

I believe this person used sockets in his sword when attached and then traced them and set the draw debug type as duration so he could see them as lines?

Maybe it’s not much help but it might lead you towards something. Just search on how to make the sockets, then you get the position of each socket position in the line trace.

You do all of this in the tick, and set the draw debug type as for duration. Give it a go, hope this helped :D.

Hello Slamyr,

I was looking over your question and I was able to make a quick example using the couch knights project. I added two sockets to the sword and simply traced a line between them. I hope this information helps.


Here you can see where I add the two new sockets “Base” and “Tip”

In this image I used two custom events to start and end a loop that fires off a line trace between the two sockets. This effectively follows the blade of the sword but only when attacking. This means that it will continuously fire off a line trace while the attack is happening.

Make it a great day

Wow thanks a lot good sir !Thanks for dedicating your time to answering my question i’ll have a look at it tomorrow have a great day :smiley:

OK thanks a lot for the answer i’ll study it tomorrow :slight_smile:

But now my problem is where do i put the attack start and attack end function ? :slight_smile:

You will need to go in to where your attack animations are being called and call them from there. This means the attack Start is called in the beginning and the attack end will be called at the end of the animation.

Thanks for the fast reply ! :slight_smile:
So this is what i did however it doesn’t work :confused:

You would need to place your delay before your “Attack End” node. The reason you are not seeing anything is because you are ending the loop right after the animation is called.

I did everything but no lines unfortunately…Maybe it has something to do with the sockets not being applied properly to my static mesh?

Maybe this will be useful to you (the weapon is the grey frame and when the game starts it is placed in the right hand socket i have created)

Wow mate i managed to fix it ! It was actually working the whole time but instead of “for one frame” , I needed to select “Duration” ! :slight_smile:
Thanks for everything man people like you deserve medals