WIP: Astral Chain Perfect Dodge 3

Oh my lord today has been productive! The short- I have the dodge working, I have a 3 step animation working and I’ve polished up movement speeds and I’ve tried some root motion stuff (although this didn’t work). After yesterday’s mishap and wasted time with mixamo, I decided to not take a chance, I used the rolls and dodges pack form the unreal store to implement the dodging.

First things first, the jittering on my animation was driving me up the walls. After about 30mins of some heavy testing, changing some variables around, etc… I isolated the problem down to the rotation I was giving my blendspace in my animblueprint. Note, my character blueprints ensures that my animation blueprint variables and my character blueprint/C++ variables are the same. Believe it or not, there is a difference when calculating the direction based on the character’s movement component vs. GetActorRotation() method. I was using the former which made the blendspace jitter for some reason. I noted it for future reference. This was the first time I’ve used that node in this context since I normally just make a custom animation instance class and do the calculation for direction and speed via C++.

I started by making a one-dimensional blend space so that the player could dodge based on the input given to him in the right direction. The pack had a roll for each cardinal direction so I just used those animations. Hooking it up into the animation blueprint was a piece of cake since I just needed player direction to implement this properly. I already had player direction since I used a similar (2D) blend space to do the player movement and idle blending. I just reused that direction variable to hook this blendspace up. All that needed to be done was to reset the dodge variable (no infinite dodging…) via a skeleton notify event which was handled by my animation blueprint. I’m not sure if its good practice or not but I used my anim blueprint to change my C++ variables in my character blueprint and since the character blueprint keeps the animation blueprint synced with it, it would change the variable on the animation side of things as well. I don’t think I’d ever hand an artist a system like this since I’d probably make a custom animation instance class that did the above for them, but since this is just me doing it, I did it this way. I also kept the dodges in place and moved them manually with code- this gave way this nice feeling sliding dodge that felt straight out of warframe! I love it, it’s just what I was going for! Not only that, flicking the “perfectDodge” bool to true while I’m dodging activates the perfect dodge animation! I just have to wire up the casting mechanic to that later!

Attacking was very similar (minus the blendspace part) I used an integer counter to keep track of where I was in the combo. If the player didn’t re-input the attack button within a window, it would reset the counter and all associated variables (including the ones used to start and stop attacking). If the player did re-input the button within the given window, it would not reset the animation variables, and it would continue onto the next attack! The last attack just reset all the variables without giving the player the chance to continue the combo period. This system makes it super easy to make the 3 step combo, a 4 step one. Just change the state machine for the animations and don’t reset the variables on the 3rd hit, do it on the 4th instead. It worked swimmingly!

I wanted to enable root motion for the attacks- this is what would breathe life into the attacks. It’s the part that I’d insist that the animator handle. Unfortunately, for some reason, I can’t for the life of me get root motion working. I have the animations working with root motion in the preview when I check process root motion in the character menu of the preview. I’ve also enabled process root motion from everything in the animation blueprint, but when I try to use the attacks, they just happen in place in-game. I can’t for the life of me figure out what’s wrong- I’ve followed guides aplenty.

I actually figured that maybe the floating pawn movement controller might be the culprit so I changed it to a character movement and even though my code compiled just fine, and my character moved just fine, dodged just fine, the attacks were in place. I changed back to my old setup and decided to use code to move the attacks on strike as a solution. Unfortunately, I should have probably just left the Character movement controller where it was since it looks like the floating pawn movement class doesn’t have an “AddForce()” or an “AddImpulse()” method. It’s 0130 as I’m writing this, I’ll have to try it tomorrow. Overall, a super productive and fun day!

-Kshaya

Back to Top ↑

Updated: