Back

Monday 30.5 | Roll & Air Control

3D Stealth Platformer Prototype

Today's focus has been on air control and getting the rolling animation working in unity.

Problems Implementing Roll

I wanted the roll animation to benefit from it's root motion, in hopes of making it look half decent. This meant that I would have to disable the characters movement when the roll was triggered and then enabling it after the roll had finished. So I needed to know when the animation would stop and call a function to set a boolean variable "rolling" to false, enabling the movement.

AnimationEvent

I tried doing this via Unity's animation events but had an issue where the events weren't triggering and read that it can be unreliable with transitions and such. More problems arose though as I tried implementing my own animation event system. I did this because someone had implemented a coroutine based system and I thought I'd try it out but got caught in trying to make it highly scalable which it really didn't need to be.

PlayerRoll

After getting back to Unity's animation events I realized it was the animators transition that messed with the event. This was fixed by triggering the event earlier in the animation lifetime. So what came of it was a mess and I should've just stuck with the animation events. Just another reminder to keep it simple.

Air Control & Rolling

  • Air control
    • Controllable from half influence to none
    • Character turns slower
    • Character only moves forward unlike when on ground
      • (On ground character moves exactly where joystick is pointing, rotation being a gimmick)
    • Animation events used to stop character controller movement when attacking to use root motion from the animations for precise attacking
  • Roll
    • Character horizontal movement stops to allow root motion to do its job
CharacterControllerFields
Back