Core Movement Realized


Hey Guys! It's me Rob! Today I am happy to bring you another update on our player's locomotion. I have been hard at work trying to get the mantle and wall running mechanics fully implemented, some bug fixes and a secret third feature as well which we'll discuss later in this week's post. So strap in because I have got a lot to share this week.


Mantling

 First the mantle. as you may have noticed from last week, our mantle was only about halfway finished. While we could detect whether or not we could mantle we couldn't actually mantle yet, also the detection for mantling was getting in the way of normal obstacles that you should be able to jump over. So the first change that I made to this mechanic was only allowing it to proc when you are airborne. This fixed our detection issue, but we still weren't able to mantle. After giving it some thought, I came to the conclusion that using root motion may be the solution. For those reading this that are unaware root motion is motion applied to a model through animation instead of through physics. In fact root motion will actively ignore ongoing physics in favor of the animation from my understanding. Only one issue, no matter where I looked I could not find a free asset for mantling let alone one with root motion.
     
     Enter control rigging. In Unreal you can look at the skeleton and IK bones of a mesh to build something called a control rig. Normally these control rigs are used for building cinematic scenes, but they can also be used to animate characters and export those animations using level sequences. So using these new tools to my advantage I created my own rough animation with the desired root motion and voila! we now had mantling added to the game! Well mostly. The animation's root motion was being applied properly but we weren't animating with our animation montage for some reason. This was one of the bugs that would later be fixed.

Wall-Running

 The next topic I would like to talk about is wall running. This actually ended up being easier to implement than I originally thought at least for the core mechanic of it. The basics of the wall run are effectively testing to see if we can wall run by detecting if we are far enough off the ground to wall run. If we are, then we now check to see if there is a wall to the left or right of our character. If there is a wall on the left or right side then we can wall run so lets update our velocity. 

    Next came the actual physics and moving the character appropriately. In order to do so we steal from some of our sliding code to perform sub-stepping to smooth out the actual movement of the character appropriately. For anybody unfamiliar with what sub-stepping is, it is the process of taking a delta time value and breaking it into even smaller bits of time to perform physics multiple times in a single frame instead of just once per frame. 


Animation

    So as mentioned before there were some issues with trying to play our mantle animation when we mantled. The root motion would get consumed and applied accordingly, but we couldn't see the animation. It was at this point that I took a crack at learning a little bit of the unreal animation blueprints. 

    These blueprints allow us to not only apply animations, but blend between them effectively playing two animations at once. So the first thing I tackled, once I did a bit of research, was blending some locomotion animation with our weapon animation. Allowing us to still have our weapon where we want it to be, but now we also move our legs instead of standing still and sliding around. This also added a bouncing effect to the weapon which helped aid in the visual presentation of us being able to sprint. 

    With our locomotion animation state machine planned out, we were now blending between two animations to give our character the proper look of being animated and real. Lastly in order to get our mantle animation to play, we now needed to slot our blended animation into a slot before putting it into an output pose. As it turned out, having our previous animations only directly output to a pose instead of going into a slot then a pose, meant that any time we played an animation montage from blueprint or code, it wouldn't work as there was no slot to override. 


Secret Time

    So now for the secret mechanic I went back and implemented. While our wall running was working I couldn't help but notice that something felt wrong about it. It had this issue where if you waited too long to jump and ran out of wall run time you would just fall. Or if you tried to jump at the exact time the wall run ended, you would use the air dash mechanic. This obviously didn't feel good. So I took a closer look at one of the inspirations for the movement of this game, Titanfall 2. As it turns out they agree. It feels bad not being able to jump if you planned on pressing it at the end of your wall run. So what was their solution? Coyote Timing.

    Coyote Timing is what we were missing. If you are unaware of what Coyote Timing is, it is a mechanic that allows you for a brief moment to jump normally when you start falling. By introducing coyote time into our wall run, two issues were killed at once, there was now a little bit of forgiveness when we end a wall run, and we could use the coyote timing to lockout the air dash for a brief moment. Its not terribly long so don't worry you'll be able to jump and immediately use your dash or movement ability. 

    As of right now Coyote Timing only applies to the wall run, however after seeing my implementation of the Coyote Timing, other members have expressed that they really like it and think that maybe it should be incorporated into falling in general, so that any time you enter a falling state, you enter into coyote time. This could definitely allow for some more control when doing a slide jump off of a ramp, so I am definitely looking into implementing this next week more than likely. 

Next Goals

    Wow thanks for reading this far. That was quite a lot of content to go over this week. With the holidays closing in, I am going to be happy to take some time off and spend it with family, however before I do that, we have one more week of work left. While it isn't everything, here is a list of goals I would like to personally accomplish before we all head out on break in no particular order:

  • Locomotion state machine logic is finished and ready to start firing other animations other than walking/running/standing/crouching. 
  • Coyote Time implemented across the board
  • Acceleration system implemented so that we may start tweaking speeds on movement. 
  • Sounds implemented for sliding, walking, and running
  • (Relies on Acceleration system)New Movement implemented: Ground Pound(Consume your speed multiplier to perform an explosive ground pound, damage is scaled based on the amount of acceleration consumed)
  • (Relies on Ground Pound)New Displacement Ability: Pound Launch(restore a portion of your speed multiplier if you use this ability within 1-2 seconds after ground pounding, also launches you in the direction you are facing based on speed restored)

Anyways, that's all from me this week, I'll be back next week to provide an update on these future goals. Hopefully I can knock out at least those first three and begin work on the other two. Until then, take it easy!

Leave a comment

Log in with itch.io to leave a comment.