It seems that the parenting of the sword to the hand.r bone is getting corrupted somehow, when exporting it just the way we did in the lecture. But there are other ways to do it in case someone is also running into the exact problem. So to export the character and animations to unreal and get them to work you can do either of this approaches:
Approach 1: Export all actions at the same time with the character mesh
Rather than exporting the character mesh with the idle animation and then exporting each animation one by one we do this instead:
-
Select the sword, hair, tom body and rig in object mode just as we did in the lecture
-
Use these export settings:
Notice the All Actions checkbox checked at the very bottom and we have both the armature and mesh selected at the top. You can skip the other selection, it wont do anything.
-
In unreal we import our export fbx with these settings:
-
Now simply drag an animation sequence into the viewport and you are done
Since we exported all the actions and the mesh simultaneously it seems unreal doesnt get confused and applies the correct sword movement. The result will look like this:
The sword movement is not bugged anymore. Still, when we want to add another animation later in our game we will run into the problem, that we dont want to import everything from scratch again, which we could of course do, but maybe you tampered with some of the original animations or did something in unreal and you dont want to redo all the steps.
Instead we can use this approach:
Approach 2: Export the Sword separately and make use of Sockets in Unreal
- Select the hair, tom body and rig in object mode just as we did in the lecture, but do not export the sword, make sure it is not selected.
- Export the idle action and the mesh just as in the instructions above
- Export all the animations like thrust, double sweep, run cycle on their own just as we did in the lecture
- Now select only the sword in object mode, make sure rotation and scale have been applied. I also went ahead and cleared the location so the sword is back at 0, 0, 0 world coordinates
- Export the sword with mesh only settings:
- Import first the character mesh with the idle animation
- Import all of your other animations
- import your sword
- Open the Skeleton of the character, NOT the skeletal mesh, but the skeleton (actually you can also work in the skeletal mesh for this one, but open the skeleton if you want to exactly follow my steps in here)
- Create a weapon socket which we want to add the weapon to soon. To do so, we search for the hand r bone which, if you remember, we parented our sword to in blender.
- Make a new Blueprint Class, have it be derived from Character Class (can also use SkeletalMeshActor Class if you want)
- Open it up, set the skeletal mesh to be our Tom skeleton and add a new static mesh component undearneath your skeletal mesh as child. Let the mesh of the static mesh component be our sword, parent it to the WeaponSocket we created earlier by clicking on the folder icon and selecting WeaponSocket. Move your sword into place. (Hint: you can play the animation and adjust the sword position midway through. To pause the animation, select your skeletal mesh component and untick the playing checkbox)
13. Now compile and save
14. Drag as much of your CharacterBlueprint Classes into your level as you want
15. You can now change the playing animation for each instance in the viewport:
Now the second approach is probably the cleaner approach here, because you could easily create multiple characters with either long or short swords and swap weapons easily by using the WeaponSocket. That being said I still did not find out how to fix my original bug where the sword location seems to be corrupted when importing as we did in the lecture. I did read somewhere that you have to name your Armature “Root” for unreal apparently or it could get buggy, but trying to rename my armature to Root did not help to fix the bug. These 2 approaches however should provide you with 2 workarounds in case you need to. I will let the question stay open in case someone finds a solution to my original bug.
If I find out anything new I will let you know. In case the thread will be closed by then, pay attention to the linked section underneath the post. I will try to remember to link to this post from the new thread then.
Cheers,
K -