So our setup for our Montage is almost complete. The final thing that we need to do actually is inside the AnimGraph. So inside the Character Animation Blueprint… Again if you don’t have it open, just hop to the Content Browser > Character > CharacterAnimBP. On the Graph tab inside Persona, hop over to the AnimGraph.
Now, here is our Locomotion State Machine which has all of our states in it our Idle_Walk_Run, JumpStart, etc. What we need to do inside of our AnimGraph though is add our Punching Montage kind of as an interceptor between when we get to our final pose here. So what we want to do is Right-click in the graph and we are going to search for…what is it? Slot. We want to add a Slot. So search for “Slot” and it is going to have an option for Slot ‘DefaultSlot’.
Go ahead and select that. You can see it gives us two poses here, so let’s connect Locomotion to our Source here. Then connect the out pose, to our Result. Now, what we need to do is let’s click on our Slot. If you look down in the Details panel down here, there is a Slot Name section. So go ahead and click the drop down for that and you should see our DefaultGroup.UpperBody that we set.
So go ahead and change it to that. So now what happens is whenever this UpperBoddy Slot is called, it is going to play this on top of our current pose from our Locomotion before going to the Final Animation Pose. So we can test this really quickly. Let’s Compile and let’s Save.
Then, let’s Play in the editor. Let’s not Play in a Mobile Preview. I am actually going to change it to New Editor Window.
I am going to change it to that. So I am going to select New Editor Window to play. It is going to pop it off-screen actually.
Let me bring that into focus here. Now what happens is if we punch, look what our Character does. He starts punching, he kind of pops up and down, and does all kinds of funky stuff there. Also if we move, you can kind of see he is running around and he stops moving his legs.
So there are all kinds of funky stuff happening, but our Punching Montage is essentially working. We can press it once, or we can hold it down. But we need to do a little bit more adjusting to get it to the way we expect it to work.
So I am going to hit Esc and go back to our AnimGraph here. What we need to do is let’s actually move this (Final Animation Pose) over just a little bit to create some more room. What we are going to do is let’s disconnect our Slot nodes here. So we are going to Right-click on this pin and Break Link to Locomotion. Right-click on this pin and Break Link to Final Animation Pose.
We need to Right-click in the graph and search for a “blend per bone”. So blend per bone. So you are going to get the “Layered blend per bone” option, so go ahead select that. You can see it gives us two poses here that we can blend between. It is going to blend those into a final output pose. The output pose is pretty simple; we can connect that right to our Result here, like so.
But what we need to do now is, (I don’t want to say it is tricky, it just requires a little bit of forethought on how you want to set this up here) we kind of need to get our current Locomotion pose, whatever we are currently doing as our base pose, right? So whatever we were doing as our base pose, we also need our UpperBody Slot. We need a way for our UpperBody Slot to receive a Source input as well.
We currently cannot select our Locomotion output pose to our Source. If you try to do that, it removes the base pose. So we can only have one plugged in at a time.
So what is the way around this? What we can do is if we drag off of our Locomotion State Machine here, we release, and we search for “cache”, it is going to give us the option to create a “New Save cached pose”. So go ahead and select that “New Save cached pose”. It is going to give us a funky name, so I am going to select that node and rename that down in the Details panel here.
We are just going to call this the “LocomotionCache,” like so. Now if we connect our pose from our Locomotion State Machine into this LocomotionCache pose like so, what we can do is Right-click again inside the graph and search for that LocomotionCache. So, “LocomotionCache”. You see we have the option to “Use cached pose ‘LocomotionCache’,” so go ahead and select that.
The good thing is now we can do this twice. We can Right-click again and Use cached pose ‘LocomotionCache’. Now we have two of them that we can use for our Layered blend per bone. So let’s grab our LocomotionCache and plug that into the Base Pose. Then let’s also grab the LocomotionCache here and plug it into our Slot ‘UpperBody’. Now, we are almost done.
There is one more thing that we need to do. On our Layered blend per bone node, we need to specify which bone we want to start this blend at. So what we are doing essentially is we are taking our Locomtion, getting that pose, and blending it with another pose that can use our Slot ‘UpperBody’ here. But at what bone do we want to start doing that?
So to do that with our node selected here, inside the Details panel if we go down to Layer Setup > Config > Element Zero, we can click the plus sign (+) next to the Branch Filters here. So click the plus sign (+). It is going to give us the option to name the bone that we want to start our blend at.
Now if we hop all the way up here to the left inside of our viewport, there is an option under Show where we can show the Bone Names. So go ahead and check that. If we zoom in, there is all kinds of stuff onscreen here. But if we zoom in, we can specify the bone name that we want to start this blend at.
So as we mentioned, we only want this to occur on our Slot ‘Upper Body’, our punching animation sequence. So anything above the spine essentially is where we want our animation to be played. So on our Layered blend per bone node if we select it again, for our bone name we are going to use spine_01. So make sure that you get the exact naming convention; it has to be the exact same, so we are going to call it “spine_01”. Now there is an option for Blend Depth. I am not going to get into this too much.
It kind of adjusts the way that it blends essentially, but we can leave it at 0. For our purposes, I think that is fine. Let’s actually Compile and test this. I think we should be good to go now. So let’s Compile and let’s Save. Then, let’s test this in the editor.
Let’s go ahead and Play. So we have the option to punch now. It looks a lot better. The Character is not dipping down anymore; it is only playing above our spine. Notice that our legs are still playing our Idle motion.
So that means we can run around and punch at the same time. We can also jump as well and punch because our blend is taking into account our Locomotion pose as well as our Montage. So we are set. I think we are done here. We can actually pause.
In the next video just for fun, we are going to add some collision around our hands so that we can affect the world. Now disclaimer on this, this is probably not the ideal way to do it but it is one way that you could do it. So we will set that up really quickly to show you how to do that. So that is going to wrap this video. We will see you in the next video where we will set up the collision so that we can start punching things. Thank you guys for watching and we will see you then.