Updates on The 2.5D Platformer

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

Roll Animation

Once you hit Left Shift, the Player rolls on the ground. I have decided to enable the Player to roll only while running (it really looked dumb on idle).

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

As I have stated, this is a very easy fix but I wanted to share it eventhough. You can find my article on Moving Platforms by clicking here.

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

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Notes On Dart

Dart logo

GitHub and git

Edge Cases to Keep in Mind. Part 3 — Time of Check to Time of Use Race Conditions in Android UI

Generate Permutations in Python Recursively From Scratch

When distributed locks might be helpful in Ruby on Rails application

SQL - Tips to improve query performance.

How to Test the Connectivity Between Docker Container and the Host Machine Using Netcat

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Ali Emre Onur

Ali Emre Onur

Unity Developer

More from Medium

Platformer: Wall Jump

Converting from 3D to 2D in Unity

Unity Profiler- Game Dev Series 144

How to Install the Universal Render Pipeline