Hey everyone, i have been working on creating a Line trace based Melee combat inside Blueprint, and i’m still fairly new to UE4, i’m stuck on how do i get my character to hold the weapon while also working only during the animation, that being the Line Trace hit detection, i’m trying to replicate Melee combat like Chivalry Medieval Warfare, to give more insight, right now i only can get the Line trace working by making it go forever or click spamming my left click, and only when i got the sword inside the “Mycharacter” which isn’t attached to the Characters socket, i would like to get my weapon attached to that socket but also being able to create the Line Trace Hit detection with my sword only during the attack animations ( just like CMW), mind you this is in the 3rd person Template as well, and if someone knows how would i go about switching weapons as well, thanks =)
Line Trace hit Detection
Getting Weapon onto socket while allowing me to use it to attack with Line Trace hit detection
and Switching to a different weapon that uses Line Trace hit detection as well. ^.^
Ok, so you know how to attach your sword to the socket already?
So you have an attack animation. What you can do here is creating “Animation Notifies”:
You can create two, one for start, one for end of your linetrace.
Then just toogle a bool that control the line trace (:
alright, so am i making two Anim Notifies or Sockets, my weapon is seperate from the character model with two sockets Start and End which creates the Line trace, just like Chivalry, if you wouldn’t mind explaining a tiny bit about how would i go about making it work, as i said before i’m still fairly new to UE4 but very much keen on learning how it all works =)
alright, i will see what i can do though i have one more question since i’m a little confused i have a hand socket for my character, and the Two sockets made on to the sword, will my two sockets on my weapon still be valid? or do i some how need to create one on the character’s skeletal mesh instead of the swords one i created to follow the Hand Socket?
Sockets != Anim Notifies.
A Socket is a place at your character skeletal mesh that adopts the movement of the specific Bone you choose for it.
For example a Hand Bone. You can then attach your sword to the socket and the sword will move like the Hand Bone does:
Normal way would be to let the sword attach itself to the actor in Begin Play or something like that by using “Get Player Character” and getting his skeletal mesh for the Attach Node. Then you can add the Socket Name you have chosen earlier and “Snap to Target” to have the Weapon Blueprint stuck to your character. (The Attach nodes can be found at the bottom of the Socket page i linked you).
Now for the animation notifies:
These are created in the Animation Editor. When you open your Skeletal Mesh, you can see a tab “Animation” at the top right corner. There are all your animations. You can there click on the sword swing animation of your character and create 2 animation notifies at the points where you really want to enable and disable the line trace. The page i linked in the other comment should help you, otherwise ask me for help again.
With these notifies, you can go into the Animation Blueprint and in its event graph you can get these Notifies as events. So as soon as your Animation hits the notify, the event will be called. With this you can change a bool in you sword BP or character BP (depens on your setup). This bool will then just enable or disable the line trace with an easy branch.
I don’t know for what do you want to use these two sockets, but yes they are still valid.
An easier way to apply damage with a sword would be creating a box collision that fits the shape of the sword and just enable and disable it with the notifies.
well as i mention’d before i use these two sockets on the sword to create the Line Tracer, Socket “Start” and socket “End”
Socket start is at the bottom of the blade and end at the top