This is for the Dynamic Combat System on the marketplace, i am not the creater of this project and this is how i got anim trails working on the weapons, probably best you make a new Dynamic combat system project so you can test it out without breaking your main project - and always make backups of your main projects,
Ok so i got it working (probably the best its going to be), it wasnt very easy to get it working so i guess iâll share with you how i did it haha.
UE4 4.18.3
-
Edit the âF_Weaponâ Structure and add a new variable âSkeletalMeshâ of the type âSkeletal Mesh object referenceâ - note after editing the structure and saving you then have to rename it - i just added a 1 to the end - and let it update the references otherwise you will get a complie error in the ABP_combat anim BP, this is the only way ive found to fix it.
-
In the Meshes - Items folder (or for any custom weapon model) you right click the weapon static mesh (ie sm_sword) go to âAsset actionsâ then âExportâ and this exports the model as a â.FBXâ file (choose a location folder and rename the exported file to âSM_sword1â (or anything as long as it isnt the same as the original static mesh file)
-
In the Meshes - Items folder in the content browser(or whichever folder you want your new imported weapon mesh) click on âImportâ choose your âSM_sword1.fbxâ file (or whatever you named your exported weapon mesh as) and on the âFBX Import optionsâ window , under âMeshâ up the top make sure you Tick the âSkeletal Meshâ option, this will show a âSkeletonâ option, make sure there is no file selected for the Skeleton (if there is , click the drop down arrow where you choose the skeleton and then click âClearâ - this is very important - if you dont clear it UE4 wont create a skeletal mesh for the imported weapon mesh) - then click Import at the bottom. (this will create a skeletal mesh, a physics asset and a skeleton , there will also be a UCX skeletal mesh, physics asset and skeleton created - for my purposes i deleted the 3 âUCXâ files)
-
Open the newly imported âSM_sword1âŚâ skeletal mesh (not skeleton) and set the Material to the old Static mesh Material (this retains the original skin) save , then click on the âSkeletonâ Option (next to mesh and Physics etc up the top right) and make sure youre in the âSkeleton Treeâ tab on the left so you can add some sockets to the Skeleton for the Anim Trail. Add 2 sockets - i named mine âstartâ and âendâ and move them to where you want the anim trail to show, i moved the âendâ socket to the tip of the blade and the âstartâ socket to just above the handle on the blade then save.(you can name them whatever as long as you remember what they are then save. Note for each subsequent Weapon model you reimport as a skeletal mesh you should name the 2 sockets on the skeleton different ie. start1 end1, start2 end2 etc.
-
Open your âBP_CombatCharacterâ Blueprint , then on the components list make sure you select âRighthandmeshâ and click âAdd Componentâ and type in âSkeletal Meshâ and add it. Note it is very important the skeletal mesh component is a child of the RightHandMesh component - now you are ready to add your Particle effects(for anim trail). Select the newly added skeletal mesh component then click add component and then choose the âParticle Systemâ component and add it, you can add particles for each weapon you have here, i added 2 for testing and named them the default weapon classes ie Steelsword and Halberd. Make sure once youâve added each particle system you select it and on the âDetailsâ tab browse for your particle âTemplateâ (Anim trail particle effect). - compile and save.
-
Open the datatable âDT_Weaponsâ and select your weapon (for this case steel_sword) and browse down to the Skeletal Mesh variable and search for the âSM_Sword1âŚâ skeletal mesh (or whatever you named the imported skeletal mesh) from the drop down list, then save.
7a) In the âBP_CombatCharacterâ Blueprint open the âOnWeaponUpdateâ Function (if you expand the âItemsâ in the functions list you will find the function here) , drag off the exec pin on the âonweaponupdateâ function and add a âSet Skeletal Mesh(skeletal mesh)â node - Note this is assuming you named the added Skeletal Mesh component in step 5 Skeletal mesh, ie in step 5 you named the added skeletal mesh component as sword, the you would add a âset skeletal mesh(sword)â node.
Now drag off the âSkeletal meshâ pin on the âBreak f_weaponâ node and connect it to the ânew meshâ pin on the âset skeletal meshâ node.
Now on the end exec pin of the âset skeletal meshâ node drag off a add a âsequenceâ (this is where we will be adding our âbegin trailsâ nodes) so make sure the last pin on the sequence node goes to the âSet static meshâ node (you can hold control and left click drag the pin connection on the sequence node so that the last pin goes to âset static meshâ. Drag off the first pin on the Sequence node and add a âbegin trails (steelsword)â node - (based on what you named your particle system in step 5 is what the name will be ie. i named my particles as âsteelswordâ and âhalberdâ so i will be adding a âbegin trails (steelsword)â and a âbegin trails (halberd)â node to the sequence, you can add as many pins to the âsequenceâ node as you need for the different âanim trailâ particles you created in step 5, i have 2 different particles -
1 for the steelsword and 1 for the halberd weapon for this example so i added 1 pin to the sequence node.- make sure once youve added the pins to sequence, the pin that goes to âset static meshâ node is the last pin on the sequence node - i will add a screenshot attached to show you for this)
7b) Now once you have your âbegin trails (steelsword)â node added the last step is to add the socket names you want the Anim trail to show on, (in step 4 i named my sockets âstartâ and âendâ) So for the âIn first socket nameâ i typed in âstartâ and for the âIn second socket nameâ i typed in âendâ (the reason in step 4 i mentioned if you create particle effects for other weapons to name the sockets on the weapon skeleton different names ie start1 end1 - otherwise it will play all anim trail particles for the sockets if you name them the same for each weapon)- compile and save.
- You need to add a skeletal mesh component to the parent âItemâ blueprint as well, so open up âBP_BaseItemâ , click on âWorldMeshâ in the components, and then add component âskeletal Meshâ , this should add a skeletal mesh component as a child of the Wolrdmesh component. Compile and save. Done!!!
There you go, woop woop Anim trails on weapons now.