Complete FPS Arms Rig and Animation Tutorial from 3ds Max to UE4
Events
Subscribe:  iCal  |  Google Calendar
7, Mar — 12, Jun
16, Apr — 23, Apr
Dubrovnik HR   19, Apr — 22, Apr
Breda NL   23, Apr — 26, Apr
24, Apr — 27, Apr
Latest comments
by Admin
10 hours ago

Jack. First of all, I want to apologize for offending you. We published this just to show how the tech could be used. We don't actually care about the message. But you do bring up a viable point, that for some people - this might be an issue, so I take this post down.

by Charles
11 hours ago

What European universities would you recommend?

by jack
12 hours ago

How about you don't associate with a left leaning partisan news site assuming all video game artists lean the same way. I'll be blocking your content from here on out.

Complete FPS Arms Rig and Animation Tutorial from 3ds Max to UE4
22 November, 2016
Report
Developers from Item_42 were kind enough to let us share their thorough tutorial. Bret Ware and Regan Ware, developers of BLISTER, have published a complete lesson on building arms and animating them for an FPS game with the help of 3ds Max and Unreal Engine 4. You will learn one way of creating a pair of first person shooter arms that are fully rigged, suitable for UE4 and easy to animate and a way of exporting the arm rig, weapons and associated animations to UE4 for use within an FPS game.

%d0%b1%d0%b5%d0%b7-%d0%bd%d0%b0%d0%b7%d0%b2%d0%b0%d0%bd%d0%b8%d1%8f

RIGGING THE ARMS IN 3DS MAX

I – Lowpoly mesh preparation

The first thing to think about is what neutral pose the arms will be in. You can either create them in a straight neutral pose which is easier for the rigger but harder for the sculptor, or you can create them in a pose that fits the position they’re most likely to spend the most time in. I went for the latter. Just note that it’s harder to accurately rig a pre-posed arm.

When you create the lowpoly for your FPS arms rig, you should double-chamfer knuckles and other areas that will be prone to large angle movements. You can blend these double-chamfered polygons between adjacent bones later with minimal UV stretching.

Before you begin rigging the arm, ensure that you’ve created the UV map and textures for the lowpoly as you normally would. The diffuse texture will be very useful in 3DS Max when looking out for UV stretching. UV stretching happens when a bone is given too much weighting on a particular face or set of vertices on the lowpoly. You want to avoid this as much as possible for a good rig.

II – Creating a custom skeleton in 3DS Max for FPS arms

1. Make sure your arms are centred at 0,0,0. There is a cheap way to do this. First, make sure all elements of your arm mesh are within the same object. 

2. move to the Hierarchy tab on the right-side panel. 

3. Select Affect Pivot Only under Adjust Pivot and under Alignment, select Center to Object.

4. Deselect Affect Pivot Only and move your rig to 0,0,0

Alternatively, if this moves your arm rig too far backwards from the centre point, move the rig forwards using the transform controls, reselect Affect Pivot Only and centre to zero using the panel in the last image above.

We will begin creating the skeleton. Press ALT+X on the arm mesh to toggle xray mode so that you can see through the mesh.

5. right click and press ‘Freeze Selection’ so that while you’re working you don’t accidentally select the arms. 

6. Go to the Animation panel and select Bone Tools.

7. Make sure you’re in the appropriate viewport. Press T to enter the orthographic Top viewport. Press F4 if you want to see the wireframe view as you work. Toggle the Layer Explorer, pick whether you want to work on the Left or Right arm and create a layer called “bones_left” or “bones_right”. Make sure it’s the active layer by pressing the grey layer icon to turn it blue. Unlike my picture, you will only have one layer right now called “bones_right”, and maybe a separate layer for your frozen mesh. 

8. Enter Bone Edit Mode and press Create Bones. Draw your first bone in the viewport. When you have drawn your first bone the next bone will automatically jump to your mouse position so you can draw the next bone. Create the upper arm, lower arm and wrist/hand. Right click twice to exit Create Bones mode. Delete the Nub bone at the end of the hand bone you just created; it isn’t necessary. 

9. Stay in Bone Edit Mode. Edit the size of the bones with the Fin Adjustment Tools. Change the width, height and taper under Bone Objects to suit the arms you’re working with. Add fins under the Fin panel if you want. 

10. Stay in Bone Edit Mode. Enter Perspective Mode by pressing P and adjust the position of the bones so that they fit the arms. Try to keep everything as straight and orderly as possible. Never twist a bone that relies on another bone using the Rotate tool unless you have accounted for the other bones in that rotation. If you do have to rotate a bone, make sure all the other bones have a similar relative transformation. 

11. Stay in Bone Edit Mode. You can sometimes (but not always) align bones by using the Align tool. Select the bone you wish to align to another, press the Align tool and make your selection in the viewport. 

12. The Align Selection panel will appear. Do not use Align Position in the case of bones that are already linked up, such as the lower arm and wrist/hand bones. Use the pivot point of the selected bone and use the Align Orientation tools to straighten up bones. If this does not work, use Select and Rotate to approximate their alignment. 

13. Select Create Bones again. Create a hierarchy of finger bones in Bone Edit Mode. This time, keep the Nub bone at the end of the hierarchy. Exit Bone Edit Mode and select all 4 finger bones. Hold SHIFT and drag along an axis. This will produce a copy. Make 3 copies for 4 fingers. 

14. It is very important to make sure the bones do not deviate on their axes. They have to be straight to work effectively. You may have to rotate the finger bone hierarchy to fit them inside the mesh, but make sure you rotate them OUTSIDE Bone Edit Mode so that they stay straight relative to each other. Look at the picture to confirm this. To make it easier, work in Local transformation mode. 

15. Adjust the connecting pivot points of bones by entering Bone Edit Mode and using the Select and Move tool under Local transformation. Once again, do not change the orientation of bones in Bone Edit Mode. 

16. When you are happy with the position of your bones, press the Select and Link tool. 

17. grab the bottom of each finger hierarchy and use the Select and Link tool by dragging it from the selected bones to the target bone which in this case is the wrist/hand bone (it operates as both the wrist and the hand for our rigging purposes). Now these bones rotate as children of the wrist/hand bone, which means if the hand/wrist bone rotates or moves, the finger bones will move along with it.

18. repeat the same steps as above for the thumb bone hierarchy.

19. Enter Bone Edit Mode again. Create a bone near the wrist/hand bone but do not attach it. This will be your “Wrist Rotator” bone. This bone will be very important. There is more than one way to make wrist rotation natural, but this method gives you a lot of control. 

20. Delete the Nub bone, exit Create Bone mode but stay in Bone Edit Mode. Select the wrist rotator bone you created. Select the Align tool you used earlier and click on the lower arm bone that connects to the wrist/hand bone. Set the Align Selection panel to Align Position and Align Orientation on all axes, as shown in the picture. Press OK.

21. in Local transformation mode, use the Move tool to drag the wrist rotator bone up to just below where you think the wrist should rotate. Use the Rotate tool to rotate the bone 90 degrees on its local axis. Make sure the bone is pointing in the same direction that the palm is facing, as shown in the picture. Use the Link tool to link the wrist rotator bone to the lower arm bone that it currently sits on. Now you have a wrist rotator bone that is connected to the lower arm and is directly centred on its pivot point.

22. Create a new bone and align it to 0,0,0 – this is your root bone. You need this for later when importing to UE4. There are different ways of doing the root bone but this is one legitimate way.

23. It’s time to start naming all the bones. Make sure you still have the Layer Explorer enabled. There is a prefix/suffix tool to easily name all the bones, but we’re going to do it manually to avoid any silly mistakes. In the Layer Explorer, press the Hierarchy View button next to the Layer View button. Now you can see how each child bone relates to its parent. 

24. Look at my setup in the picture. The root bone is at the top of the hierarchy:

  • Name your root bone “root_bone”
  • Name the upper arm bone “r_arm_shoulder” (or “l_arm_shoulder” if you started building your bones on the left)
  • Name the lower arm bone “r_arm_elbow” (because it swivels on the elbow joint)
  • Name the wrist/hand bone “r_arm_wrist” (because it rotates on the wrist joint)
  • Name the wrist rotator bone “r_arm_wrist_rotator” (this bone is separate to the wrist joint, its purpose is to separately control the gradual rotation of the whole lower arm up to the elbow)
  • Name the fingers “r_finger”. Follow with their denominations: “index, middle, ring, pinky”. Within each finger, name each bone according to its order: “low, mid, high, tip”. Look at my setup to see how I have done it.
  • Select all the bones APART FROM “root_bone”. Using the Layer Explorer in Hierarchy mode, drag all the bones INTO “root_bone”. Now the root bone is doing its job. 
 

25. Now you have a full arm skeleton. Feel proud. It’s time to mirror the arm. There is a cheap way to do this without having to use the inaccurate Offset dialogue:

  • Enter Bone Edit Mode. Press CTRL+A to select all the bones (make sure nothing else is selected besides bones in the scene).
  • Press “Mirror”. The mirrored bones should fill out the space where the opposite arm is located.
  • Rename the bone prefix “R” to “L” and delete “(mirrored)”. There is a tool to do this for you but it’s fiddly.
  • Delete “root_bone(mirrored)”.
  • Move your new “l_arm_shoulder” hierarchy under “root_bone”.
  • “r_arm_wrist_rotator” may not have mirrored correctly. If this is the case, delete the warped mirrored bone and manually mirror the bone yourself by repeating the previous steps and making sure the coordinates of both left and right wrist rotator bones match up.

26. Now you have two arms perfectly mirrored.

III – Setting up the IK systems and controllers

The complete skeleton is in place. You will now use IK controllers and various positional and orientation constraints to make this rig much easier for the animator to create high quality animations.

27. Select the tip of the index finger and navigate to the Animation panel. Select IK Solvers and pick HI Solver. 

 
28. Connect it to the low bone of the index finger. You now have an IK chain. Test it by moving the IK goal (the blue cross-shaped handle).
 

29. Add HI Solvers to the rest of the fingers. Correct the position of the IK goal from global to local transformation by using the Align tool on the “_high” bone and orienting the Z axis, so that the Z axis points right, the X axis points diagonally up and the Y axis points diagonally downwards. This will let you move the IK goal nicely and in the correct Local transformation. 

30. Use the Link tool to connect all the finger IK goals to the “arm_wrist” bone.

31. Test your IK chain by selecting them all and pulling them forward on the local Y axis. 

32. Set up another IK chain, connecting “arm_shoulder” to “arm_wrist”. 

33. Now we will make a controller for this IK chain and the wrist. In the Create panel top right, move to the Shapes tab. Stay on Splines and select Circle. Draw a spline circle onto the world.

34. Right click in the Modifier box. Convert to Editable Spline.

35. expand the Editable Spline dialogue. Select Spline. Press CTRL+A in the viewport. Hold SHIFT and rotate 90 degrees to create a new spline, and then another one until you have a full controller.

36. Press “Enable in Viewport” under Rendering on the rightside panel. Now you have a rendered version of your spline controller in the Viewport. Adjust the radial options to your liking. I go for 4 sides and a thickness of 0.4. If you need to scale your new controller, don’t do it with the normal Select and Scale tool – go into Spline under Editable Spline under the Modifier List and use Select and Scale from there. 

 
37. You can also draw a line between the spline vertices by using the Grid and Snap Settings. Select Grid Points and End Points in the dialogue box, press Create Line under the Geometry tab and then draw a line between two points on your IK controller. This is useful as a line-of-sight guide to make sure your IK controller isn’t rotated in the wrong place and is lined up with the wrist rotator controller, which we will make after this.
 

38. Align your new IK controller to the “arm_wrist” bone on all positional and orientational axes.

 
39. Rename your new IK controller to “arm_wrist_ik_controller”, with the appropriate Left or Right prefix. Now select the IK goal, which is the blue cross sitting on the wrist joint. Use the Link tool to link it to “arm_wrist_ik_controller”. Now you can move around the IK controller and the wrist IK will follow.
 

40. Select the “arm_wrist” bone. Move to the Animation panel. Select “Constraints” and then “Orientation Constraint”. Connect the Orientation Constraint to “arm_wrist_ik_controller”. Now the orientation of the wrist and the rest of the hand will not be affected by the orientation of the IK controller. This is useful for animators so that they don’t have to keep correcting the rotation of the hand. 

41. To help out animators more, we are going to add a custom attribute called “Elbow Swivel”, in case the IK controller for the wrist moves awkwardly. Select “arm_wrist_ik_controller”. Go to the Modifier List and add an Attribute Holder modifier.

42. With the Attribute Holder modifier selected, press ALT+1 in the viewport. A parameter box will appear. Under UI Type, name the Parameter “ElbowSwivel”. Under Float UI Options, size the width to 100. Set the range from -10 to +10. Set the alignment to Right (or Left if you’re doing this on the left-handed arm). Press “Add” to add the custom attribute to the Attribute Holder modifier. It will appear on the right hand panel.

43. Go to the Animations tab and open the Reactions Manager window. With “arm_wrist_ik_controller” selected, press the green PLUS button at the top left. Then select “arm_wrist_ik_controller”. Navigate to Modified Object > Custom_Attributes > ElbowSwivel. You have now added the Master. Now select the wrist IK goal (the blue cross). Now press the white PLUS button on the top left of the Reaction Manager. Link it to the Swivel Angle value. Press the down arrow with the orange dot to add two new states. Set them as I have in the picture.

44. Rename the Attribute Holder to “Elbow Swivel Right” (or Left if you’re using the left arm). Try out your ElbowSwivel attribute. It should swing back and forth in a 180 degree arc. That’s now done, you have made a custom attribute to account for any potential awkward IK movement.

45. Create a new spline controller, this time with only one axis. Use the Align tool to align it to the wrist rotator bone, “arm_wrist_rotator_controller”.

46. there are several ways to constrain this setup. You can figure out your own or follow my steps. If you’ve deviated or done something slightly differently you can easily figure out your own way of making sure the controller and the bone stay fully connected. First, Link the wrist rotator bone to the elbow, or drop it under the elbow in the Hierarchy panel of the Layer Explorer. Link your wrist rotator controller to the elbow. Add an Orientation Constraint from the wrist rotator bone to the wrist rotator controller.

 

47. Select your wrist rotator controller and navigate to the Hierarchy Panel on the right. Select the Link Info tab. Lock every axis apart from the Z axis (or whatever axis rotates your wrist rotator bone). Now you can’t accidentally move the controller in any direction other than the one that it expressly controls on the skeleton. 

48. Now we will make a box that controls either arm of the skeleton without affecting the rest of the bones in the hierarchy. Go to the Create panel and make a Point Helper. Change its Display parameter to Box. Adjust its size to your liking. Align the point helper to the upper arm. With the upper arm bone selected, use a Position Constraint between the upper arm bone and the Point Helper. Rename the Point Helper as “shoulder_controller”, plus whether it’s left or right. 

49. There is no way that I am aware of to mirror all these controller setups. Follow them again to create the controllers for the arm you’ve left alone. It shouldn’t take long now that you know what to do.

You’ve got a full rig now that hopefully works well. Now it’s time to skin the mesh to the rig. If you have a base arm and multiple clothing items that go on top of the base arm, there is an extra step that I will show you at the end of part IV.

50. Unfreeze your base mesh and press CTRL+X to remove X-ray mode.

51. Go to the modifier list and add a Skin Modifier. Scroll down to the Bones section of Parameters. Press Add.

52. In the new window, select all the bones besides the fingertip bones and the root bone and confirm. 

53. Test out the skinning. In some places it may be incorrect, especially if your mesh and rig aren’t straight, so we will need to adjust it either by adjusting the envelopes or by painting weights. 

 
54. To edit envelopes, select Edit Envelopes under Parematers. A series of splines corresponding to the bones should appear. Use the Move tool to adjust their size by grabbing the radial splines. If you need to adjust the position or length of the envelope, select either vertex on the yellow spline and use the Move tool.

55. If your fingers are moving strangely, as you can see in Point 53, your wrist/hand bone may be affecting the finger bones. Move the wrist/hand bone envelope away from the fingers, or use the weight tools that I will describe in the following points below.

56. I don’t fiddle with the envelopes much–just enough to have a good approximation of the weighting so that the mesh deforms nicely when moving the rig. For finer control I prefer to weight the bones myself with the Weight Tool. Select Edit Envelopes and tick “Vertices” under “Select”. When you start editing the weights manually, modifying the envelopes themselves no longer works.

57. Scroll down under the modifier to “Weight Properties” and enable the Weight Tool.

58. Press F4 to enable edged faces. You can now select vertices and use the Weight Tool to weight them. Weight the fingers so that they have a value of 1 in the middle with a nice blended weighting to the bones either side. Experiment with the ring, loop, shrink and grow functions. It’s best to start on a low weight value of 0.1 or 0.25 and build up to red, or a value of 1. 

59. The most important adjustment you will make is to the “wrist_rotator” bone. As you can see in the picture, give it a large gradient with the greatest weight values centred around the wrist itself. Use the “Blend” button under the Weight Tool window when you’re happy with your weights to smooth them out. When you twist the rotator bone now, you will notice it has a long and gradual gradient to the elbow. This lets the animator offset the wrist movement against the movement of the hand for a more natural-looking mesh deformation. 

60. Some bone hierarchies will be awkward to weight properly. This whole process is just trial and error, so just be intuitive and you’ll eventually get the results you desire. 

61. When you are happy with the weighting of all your bones and they react nicely you can X-ray and freeze your mesh again. It’s almost ready to send to the animator. Before we freeze all the bones, though, you might have some accessories to add, like a watch. If you use the Link tool to attach the watch to wrist rotator IK controller, it very conveniently moves with the wrist bone. You will attach the watch mesh separately in UE4 using a similar method.

62. It’s time to prepare the Max file for the animator. It’s much easier for the animator if the bones have a “Frozen Transform”. This means that if you set the transform to zero, the bones (and the mesh) will jump back to their original position. Grab all the Point Helpers, IK Controllers and IK Goals. Hold ALT+right click and select “Freeze Transform”. Accept the dialogue window that pops up. Now test it by moving an IK controller, then pressing ALT+right click and pressing “transform to zero”. It goes back to its original position. Very handy.

63. Select all the bones APART FROM the thumb bones, which have no IK Solver. Right click to freeze them. Now the animator can only transform the IK Controllers, IK Goals and Point Helpers which means there is less chance for a destructive accident to occur while animating and selecting things. 

64. If you have a base mesh and you want to skin clothes on top, skin the base mesh as described in the previous steps and then select your clothing mesh, add a Skin Wrap modifier and under Parameters add your Skinned mesh. Your clothing should now almost perfectly wrap itself around your Skinned base arm mesh. If you need to tweak it, you can convert the Skin Wrap modifier to a Skin and follow the same steps above.

65. If necessary, you can add the diffuse texture to the mesh. Unfreeze your Skinned mesh, press M, scroll down to Maps, tick Diffuse Colour and press “None”. Choose “Bitmap”, press “OK” and then select your own diffuse texture in the file browser.

66. If the texture isn’t showing, configure your viewport as in the image displayed. There’s no need for Realistic Materials with Maps or Normal/Bump maps because the animator doesn’t need the arms to look pretty and the framerate needs to be high.

The rig is totally done. Now it’s time to start animating and preparing for export to UE4.

2. GETTING THE RIG (AND WEAPONS) INTO UE4

There are a hundred ways to set up the rig/weapon relationship to get it into UE4. How I think a lot of people do it (and think about doing it) is having the two completely separate in-engine. Most people have it so that there’s a skeleton for each gun and a skeleton for the arms. 

This means you have to either have identical animations for each of them (effectively importing the animations twice) or having the gun as a collection of static meshes that you move by parenting them to sockets on the arms or using blueprints. 

Originally we did the former, where each gun had a separate skeleton and we had 2 animation assets for each animation. This also meant we had to make so many animation blueprints that are basically identical! Both of these ways are a big fat pain in the arse, especially the one where the gun is a static mesh.

Instead, imagine all of your guns and arms can use a single skeleton and even a single animation blueprint. That’s what we wanted for BLISTER. I won’t be talking about the process of actually animating here, both because that’d be a massive tutorial itself and I’m not good enough at animating to do it justice.

So, there are three main points to bear in mind with this workflow:

  • The skeleton is really just a hierarchical list
  • The shape and position of the bones is actually dictated by the animations (and the base, ‘original’ pose of the skeletal mesh)
  • A mesh or animation doesn’t have to use every bone of the skeleton. 

By “use” a bone I mean whether the .fbx of the animation/skeletal mesh file you import contains the bone in question. This means we can have the all the bones of the arms and bones for the weapons in the same skeleton.

Look at the image below. You will see a bunch of the bones for the arms, and attached to the r_arm_wrist_ik_controller you can see the bones for guns.

A hierarchy of bones used to manipulate the guns parented to the r_arm_wrist_ik_controller bone

A hierarchy of bones used to manipulate the guns parented to the r_arm_wrist_ik_controller bone

To get our weapons working with this when you skin them you have to use only the bones available in the skeleton. So for the first gun skin it as normal, in our case we did the Kriss Vector which is helpful since it uses all the bones found in our hierarchy. 

If the gun you want to skin first doesn’t use every bone you think you might need it doesn’t matter, you can just create a bone at 000 or wherever you want really, and name it accordingly. You might want to add a ‘hammer’ bone for example for when you’re adding pistols. What we did is use the ‘stock’ bone for hammers on pistols. This means we can’t use the stock bone elsewhere but on a pistol you won’t ordinarily have a stock anyway.

So we’ve got our first skinned weapon and we’re ready to attach it to the arms. First place the arms and gun where you want them, probably with the gun in the arms hand. Then attach the gun’s root bone (Or in our case a helper to which everything is parented) to the IK controller for the right arm. Now that the hierarchy is set up it’s worth getting the skeleton into UE4 before we animate just to make sure everything is right.  

Attaching the skinned weapon to the arms

Attaching the skinned weapon to the arms

First we’ll get in the skeleton and the arms. If you want to import a skeleton into UE4 it has to be with a skeletal mesh so we’ll import the arms along with every bone in the skeleton, including the weapon bones. So select the arms mesh and every bone and export them using ‘export selected’.

Exporting the arms mesh and all the bones it has been skinned to, including the weapon bones

Exporting the arms mesh and all the bones it has been skinned to, including the weapon bones

Now we’ve got our file containing the arms mesh and every bone of the skeleton. Import this into UE4 and make sure the ‘skeleton’ field is set to none so UE4 knows to generate a new skeleton for the import. You should get these two assets (and maybe a physics one but we don’t need that)

The skeletal mesh and skeleton asset imported into UE4

The skeletal mesh and skeleton asset imported into UE4

We named our file BaseArmsAndSkeleton. Looking in the skeleton asset you should see the weapon’s bones in hierarchy form, just like the image at the start of this tutorial Part 2.

Next we can import the skeletal mesh for the gun. In 3DS Max select only the gun and the weapon bones that it uses, and export selected as before. Import it. Instead of the skeleton field being ‘none’ set it to the skeleton we just imported. It should import fine and be viewable just like the arms.

Now, if everything matches up between 3DS Max and UE4, you can start animating. This section is up to you since animating is a whole subject by itself and requires a lot of practice. If you followed the first half of the tutorial and have the exact rig that we do then it should be fairly painless but it’ll still take some learning.

Once you’ve got some animations ready, you can export them by selecting just the bones including the weapon bones and exporting only them using ‘Export Selected’. Make sure you don’t include any meshes when you export animations. Import these animations into UE4 and set the skeleton as the one we just imported. You should then be able to see the animations and preview them on both the arms and the gun. 

(Tip: To preview different meshes in the same skeleton, click the little grid icon next to the ‘mesh’ display and you can choose any skeletal mesh that’s using this skeleton.) It’s worth using this to check that the gun and arms are both using the animation properly. 

Once you’ve imported all the animations for your gun we can finally get to the blueprints. 

I implore you to use a master weapon class for your weapons. This means you can have things like damage, recoil, ammo etc. declared in here, functions like ‘fire’ made common to all weapon and it just generally saves you a tonne of time. This kind of thinking is central to Object Oriented Programming and if you’re not familiar please read up on it now cause it’s literally everywhere when programming for games. I’m assuming you have some knowledge of blueprints already.

First we need to create an ‘anim blueprint’ for our meshes. Since all the meshes use a common skeleton we can use a single anim blueprint for all of them and just make it use variables to determine what animation to play. 

Right click on either of the skeletal meshes and under ‘Create’ click ‘anim blueprint’. In here we have 2 tabs: the Anim Graph and the Event Graph. The Event Graph is just like any other blueprint graph, but there’s already a node which is called every tick while this anim blueprint exists. The anim graph is a bit different and we’ll talk about it later.

First thing to do is create the variables we need to determine what animation we should play. In BLISTER we keep track of the state of the player, if they’re aiming down sights, if they’re playing an anim montage on the left arm, the current weapon and its ‘state’ animations. The states in your case are simply run, idle and sighted.

We set these variables by grabbing them from the player blueprint every tick so that they constantly update (except the player character, weapon and state anims variables since they don’t need to be kept up to date so much). We set the player character variable by calling “get player character, and using the return from that cast it to your specific player class. The return from this cast is what you should use to set the player character variable. Hook up these nodes to the” blueprint initialise animation” so it’s called whenever the animation blueprint is created. The weapon/state anims are set in a function that’s called whenever the player equips a weapon from the player blueprint class

Now we come to the anim graph. This a simplified anim graph that should fit well for you purposes. You can get more out of this like blending between animations (and we use that for playing animations on the left arm while holding a weapon, for example) but for now this will work.

The state machine ‘Movement’ is expandable and we’ll take a look inside in a second. This contains the logic to choose which state animations are played. We cache this just for easier use later, we can just call ‘Use cached pose ‘Movement Cache’’ since anim graph nodes can only ever output to one place. 

Call 'Use cached pose 'MovementCache'' because Anim Graph nodes can only ever output to one place

Call ‘Use cached pose ‘MovementCache” because Anim Graph nodes can only ever output to one place

Now this goes into a ‘slot’ which allows us to play anims like fire and reload, since we’ll be playing them as animation montages rather than regular animations. This means they’ll be blending on top of the state animation smoothly rather than instantly jerking into the reload. It also just generally makes life much easier. 

Now double click the movement node to go inside it.

Inside the Movement state machine, we see this: 

Here we have nodes and transitions. Nodes contain an animation to play and transitions contain a condition statement that if true, will follow the transition to the node it points too (see the arrows). So inside the ‘idle’ node we have this simple setup: 

Create a node to play the idle animation. At first it won’t have the ‘Sequence’ and ‘Play Rate’ inputs, you can add these by selecting the node and in the details panel on the bottom right tick ‘as input’ on any variables you want to plug into. You can see here we plug in the idle state animations from state anims and the idle play rate into the appropriate inputs. ‘Sequence’ just means the animation to play. The “Kriss_idle” in the node name is just the default.

Now let’s go back and look at a transition from idle to run: 

Here it’s very simple. We’ve got the “IsWalking” variable that we made earlier, and plugged it straight in. Now if it becomes true, the execution moves from idle to run, and the run state anim plays.

So we’ve got the anim blueprint. You want to make sure this is applied to the skeletal meshes of both the arms and guns when you place them in a blueprint. You can find it in the details panel when you’ve got them selected within a blueprint.

Back to the weapon class we mentioned earlier. In here we want a skeletal mesh component that’ll be set when you make a child instance and a bunch of variables containing all the animations for that gun. Our weapon class has these animation variables:

Animation variables for the Weapon Class

Animation variables for the Weapon Class

Notice that most of them are ‘montages’: these are the animations that we’ll play using the slot in the anim graph. The others are used for the state anims played in the state machine. The type of montage variables should be set to ‘anim montage’ and the state anims variable type should be ‘anim sequence’.

Now how do we play these montages? The easiest way is to make a function in the weapon class. Call it ‘PlayMontage’. You can see it has one input, ‘montage’ which is an enum and an output which is simply the duration of the played anim montage.

Creating the PlayMontage function within the Weapon Class

Creating the PlayMontage function within the Weapon Class

To get the enum we need to create one of our own. Back in the content browser, click new, blueprint and choose ‘enumeration’. Open this up and add every type of animation you’ve got, then you can set this enum as the type of PlayMontage’s input and create the ‘Select’ node shown above.

Create an Enumeration and add every animation that you need for your weapon animation

Create an Enumeration and add every animation that you need for your weapon animation

Now the weapon class should already contain a skeletal mesh component, in our player blueprint we need to add a skeletal mesh component and set its mesh to the arms we imported at the start, along with setting it up with the anim blueprint we made already. 

However, the weapon is where the anim blueprint is actually being applied and the montages played, so we need to make the arms follow what the gun is doing at all times animation-wise. To do this we use a node ‘set master pose component’. In BLISTER we call this whenever a new weapon is equipped, setting the arm’s ‘master pose component’ to the newly created weapon. 

When you call the play montage function just select which type of animation you want to play. It will now play on both the weapon and the arms. 

Source: Item_42
Comments

Leave a Reply

1 Comment on "Complete FPS Arms Rig and Animation Tutorial from 3ds Max to UE4"

avatar
Maxi
Guest
Maxi

First of all, this is an amazing tutorial, thanks a lot for sharing it.
I encountered a problem with the wrist rotator bone and its IK controller, after all configuration, the IK controller rotates and moves along the wrist rotator bone, but neither the wrist or the low arm move along with it. Any help?

wpDiscuz