Xodius Studios Blog Post #5 - Bow Mesh Skeleton Creation
Xodius Studios Blog #5
Bow Mesh Skeleton Creation
The Problem:
The main problem this week was getting the bow and arrow system to work in the game using our asset pack. We have 3 bows and 3 arrows we can switch in and out of use. The main issue was none of the bows have a skeleton. Therefore animating the bow and arrow to make it be 'drawn back' to fire, was not easily achieved. This made it very hard to get the animation to work in Unreal and the arrow had no socket to attach to on the bow, so the arrow could be attached to the bow, but it's position couldn't change. This made the game not very believable for the player and the arrow refused to 'detach from actor' correctly, without a socket on the bow.
Problem Solution:
Most tutorials said Unreal can create the skeleton for you on import, but this only made a single 'bone' like the picture above. The best way I could find was to create them in an art program before importing. I decided on the free option and used Blender.
In Unreal 'Content Browser' if you right click the bow you are given 'Asset Actions -> Export...' as a menu choice. If you click export, it will save the asset as an .fbx file which Blender can read and edit.
Once exported if you open Blender (I was running version 3.4.1), there is an option under the 'File' tab that says 'Import -> FBX(.fbx)'. This will open the .fbx for editing. To add an armature/skeleton you must be in 'object mode' and click on the bow. Select the 'Add -> Armature -> Single Bone' from the menu.
This will create a GIANT bone on the bow. Change to 'Edit Mode' instead of 'Object Mode' and click on the a 'Ball' on the end of the bone. Click the 'Transform/4-way arrow' button on the left side and this will allow you to change the 'length of the bone'.
Using the matrix (red/blue/green arrows) click and drag the bone to where it should be, Rotation can also be used to orient it correctly. 'Rotate Object' is the next button on the left just under the 'Transform/4-way arrow'. If the bone appears behind your image, you can choose the 'Green Armature Guy' on the right side and choose 'in front' to bring it in front of the bow image.
To create a second bone, (if still in edit mode) left-click and then right-click on either ball and choose 'Extrude' from the menu. This will create a new bone attached to the current bone. Continue this process until your skeleton is complete. I found it best to create an extra bone for the 'middle of the string' to add the socket to in Unreal, for ease of use.
Now you can double click each bone in the top right and it will let you rename each bone. Now comes one of the most important parts, which cost me multiple days. The 'Parenting' of the main object!
I originally made a root bone and made it the 'parent' object. This is INCORRECT. The imported BOW MESH is the parent. To set this as the parent, go back to 'Object Mode' and left-click the 'green triangle' in the hierarchy. Now right-click on the highlighted piece and choose 'Parent -> Bone' to make it the parent to the bones!
Now the .fbx file be exported to Unreal using 'File -> Export -> FBX'. This will create a pop-up that can be used to name and change the export settings. My settings are shown below The ones of note, for Unreal is 'Object Types -> Armature' and '-> Mesh ' must be chosen! The 'Transform -> Forward -> -Z Forward', 'Transform -> Up -> Y Up' and 'Armature -> Armature FBXNode Type -> Null (unless you have problems on import then change to 'Root') should also be set.
Now you can import your bow back into Unreal by right-clicking in the content browser, and choosing 'Import Asset' and find your .FBX file you just named/created. The important import settings are the 'Skeletal Mesh' box. It will need to be clicked, and then the 'Skeleton' should be removed by clicking the yellow return arrow making it say 'None'. Now you can click 'Import All' and Unreal should create your skeletal mesh!
There are many tutorials and guides on the internet, but this is what worked for me. This allows all the skeletal bones to be seen and sockets added to any bone for animations. I also had to reapply the material, but that was a minor inconvenience. This was very helpful on getting the bow to work correctly, and hope it helps others as much as it helped me!
Comments
Post a Comment