Summary of accomplishment:
- Solved the issue where attack animation did not blend when running
- Created a blend space for idle/walk/run to simplify the animation state machine
- Created a stairs mesh (with custom collider)
Yesterday I said,
I started to setup layered animations to blend the attack and run together, but unfortunately I did something wrong and the attack animation barely moves the player’s arms if played during run. I wonder if it has something to do with the animation scale. I’ll need to do more studying and testing.
Recently I shortened the attack animation to only 7 or so frames in order to allow rapid attacks. Upon implementing animation layering I found that the montage appeared to play only very briefly before ending. Shortly after going to bed the solution came to me: the blend in/out duration was too long for such a short animation.
I opened up the Animation Montage responsible for the attack animation and set the Blend In/Out to zero, effectively disabling the blending. Now the attack animation plays in full on even while walking and running!
Next, I decided to change out my Walk/Run logic for a simple Blend Space that will blend between the Idle, Walk, FastWalk, and Run states dynamically based on the character’s movement speed. This was extremely easy to do. I created a 1D Blend Space via the Content Browser -> Animation -> 1D Blend Space menu. I named the single axis Speed
and set the maximum to 500 as my character’s max speed is 480. I set the number of divisions to 5, then I placed the Idle at 0, the Walk at 100, the FastWalk at 200, and the Run at 400.
Next, I went over to the animation blueprint and I swapped out the Idle animation for the IdleWalkRun blend space and that was it! The Animation Blueprint State Machine currently looks like this:
I realized that my Attack Ready pose, with the weapon held forward, was not being blended properly with my IdleWalkRun Blend Space. After a bit of considering, I setup my IdleSwordOut state like below and it blended the two animations perfectly.
Moving on, I was dissatisfied with how the camera jolted as I went up the stairs, so I decided to set the collision on the stairs to be a flat ramp. This posed a problem as I couldn’t figure out how to edit the collision mesh directly in UE4. After some research, I found a very simple way to model custom collision meshes in Blender (exported as FBX).
For the model below, called BlockStairs
, I surrounded them with a very primitive shape modeled from a cube with the display set to wireframe. In order to use this mesh as the collision mesh there are two requirements: its name must begin with UCX_
and it must be parented to the object for which it provides collision. Therefore for my BlockStairs
model I named it UCX_BlockStairs
and parented it to BlockStairs
. When I exported the FBX and imported to UE4, the collision mesh showed up under simple collision.
Finally, a brief demo of my testing sandbox with all the recent developments.