Updates on The 2.5D Platformer

Today, I have added a Roll animation and fixed a minor issue on the Moving Platform.

Roll Animation

I have downloaded the animation that I downloaded from Mixamo. I am aware that the Roll animation is not perfect (as you can see the back of the Player does not actualy touches the surface that we are on) but I will stick with it.

As default, the animation has an end that looks bad to the eye as follows:

As you can observe, the Player looks like sliding on the surface as the animation completes. I shall note here that the “Transition Duration” was set to 0.

By manipulating the Exit Time (lowering it a little bit), I have got a more satisfying result :

Looks better for sure.

Here, it is important to disable the Player’s ability to move into another direction or jump during the time of the roll. Thus, I have created a private bool with a public property of rolling. While rolling, the Move method will not be called. And once the animation is over, it will reach to the Player’s public roll property to set the rolling behaviour to false again.

It is important to note that we only want the player to roll while he is grounded.

And here’s the RollExit behaviour that is called once the animation is over.

Lastly, I have figured that the rolling bool somehow does not return to false if I keep on trying to move the player during the roll animation. So somehow, the exit behaviour is not being called. Since there are 2 possible transition from the Rolling animation, I have added the same mechanism to both of the animation behaviour — which made the Exit state behavior on the Roll animation redundant. I am aware that this is not the optimal fix, but hey! it is good to be getting familiar with animation behaviours.

Jumping On A Moving Platform

So the basic idea is to make sure to change the parent of the game object in order to make the Player move with a moving platform. Likewise, the idea is to unparent the Player once he/she leaves the moving platform. So look what happens when you get into a moving platform with an object using Character Controller.

Once we take a look at the Moving Platform, the triggering collider’s are located only on the low surface of the platform, meaning that once we jump, the player becomes deattached from the Platform during the time on the air, and the reattached once touches the floor.

So you get the easy fix, simply changing the size of the collider towards up will fix it.

Unity Developer