How to do advanced melee/staff animation

Hi, I’m new here.

I’m mainly a C++ programmer, but i also know a little about 3D modelling.

Currently I’m planning on making a hack 'n slash game similar to Ninja Gaiden Sigma and Original Devil May Cry series.

To begin with, I’m making a test 3D character model but due to my limited knowledge about 3D modelling and how Unreal 4 deals with animations, I’m, wondering:

What is the “Unreal way” of dealing with animating a character holding a staff?

The character is supposed to be able to do attacks like:

  • character spinning like a tornado holding the staff at the tip
  • spinning the staff like a propeller holding the staff at the center
  • passing the staff from one hand to the other hand
  • throwing the staff like a boomerang or javelin

For those different scenarios I find that I need to create the bones in different hierarchies.

So, Is the “Unreal way” to switch model depending on what attack is to be played (and hope that the end pose perfectly matches the next to be played), or is there a better way?

Sorry if this is a n00b question or I’m taking on too big challenge to begin with, but I want to go nuts and do crazy attacks like those found in my favorite games.

Any help or feedback would be greatly appreciated!

Well the animation part is easy. Just animate the clip and create an action trigger.

Getting into and out of the clip is the hard part and keeping everything slick and not patchy takes a bit of planning.

On our project we have a need for a lot of single frame poses as well as get into and out of animations and what we are looking into is making use of the 2dblend space as a 2d array and pile as much of the action animations into it. This way all we nned to do is send in the address, location, of where the clip is in the blend space and it does the proper blending as free lunch.

Personally I would love to see the blend space expanded as it would be possible to put all the animations into a single space.

I find the rigging part confusing!

  • if i put the bone for the staff at the center of the staff and connect it to the right hand I can do the spinning propeller attack, but can’t easily pass it to the other hand or throw it
  • if i make a root bone that is attached to the pelvis and have the staff be on a separate branch from the pelvis (connected to the root bone) then i can move the staff freely but it wont follow the hand perfectly during the tornado attack as the pelvis is rotating (making the hand move in a round-curve) while the staff is translating and moving in a linear-curve between the keyframes.

So to me it looks like I need to switch between several models, but that feels like a “dumb” solution as the poses must match perfectly in the different models!

Ah OK

In context if this is a single character, and as an animator I would add axillary effectors to the character rig and then create the animation using the staff prop like any other weapon so for a given action you would only need to patent the staff to the effector. Simple and direct.

The way I do it for Mayhem League (a very similar game) is I create the weapon as a separate mesh, and I have bones for it on the skeleton. But the vertices of the weapon aren’t WEIGHTED to these bones, I just use a constraint inside the animating software to visualize the relationship.

The exported character rig has these empty “weapon bones” with nothing attached. Then, inside UE4, I add a static mesh component to my Character, using the weapon mesh, and I set it to be a child of the Skeletal Mesh, attached at the weapon bone (note, you may have to play around with the transform of the mesh to get it aligned properly).

Then, I can control the visibility and attachment of the mesh with ease. For example, I have an attack where the player throws his sword like a boomerang; I have a special Blueprint which has spherical collision and a copy of the sword mesh set to rotate at a constant rate; using a Notify in the throwing attack anim, I simultaneously spawn this actor and set the visibility of the attached sword to “hidden”. When the attack completes, I destroy the Blueprint actor and set the visibility of the attached sword to “unhidden” again.

I find this is the best approach; socket attachments are okay for guns but for animating melee attacks, having a “control bone” works wonders.

EDIT: As for parenting, my advice is to make ALL weapon bones/rigs children of the ROOT of the skeleton. When you want the weapon to follow the hand, you should use a constraint inside your animating software to make the bones mimic parent/child connectivity without actually BEING parented. That way you can do things like switch hands, resheath, etc. and use keyframes weighting to adjust which bone the weapon tracks (my sword bone tracks the scabbard until the hand grabs it, then tracks the hand, then at the resheath tracks the scabbard again).

Inside UE4 these connections vanish, and all UE sees is two bones which happen to move in conjunction… But when building the anims this gives you the flexibility you want.

EDIT 2: A demonstration since I love shilling for my game since examples always help!

The weapon rig has 3 bones below the root: the Scabbard, the Sword and Magazine. None is a child of the other; they are all simply tied together with constraints in Blender. The Weapon rig’s root bone is a child of the entire skeletal mesh (meaning its root bone is lower in the skeletal hierarchy than the main rig’s root bone)… but I use constraints to tie the elements together. So for example, when running, the scabbard is constrained to the skeleton’s spine, and the sword and magazine are constrained to the scabbard. When the melee combo starts, at the moment the character’s hand touches the sword, the constraint holding it to the scabbard is keyframed to be 0 weight and the one that holds it to the right hand is set to 1 weight. The advantage here is the sword can either act as a child bone of the hand OR the scabbard, without having to do compensatory animation (i.e. bending the spine doesn’t cause the sword to behave strangely).

You can also see in the combo that sometimes the sword moves to the player’s left hand (during the heavy 3-strike combo), and during the gun-swing the sword is re-constrained to the scabbard and the scabbard itself is constrained to the hand instead. Also, for the throw attack, the sword is made invisible and a new actor is spawned in its place using the same mesh and particle systems.

1 Like

Also, I suppose a picture is worth a thousand words.

Thank you guys!

Now I got a better idea of how to do this.