The gliding skeleton (Side Scroller)

It's finally week 8 and we're now onto a Side Scroller brief. For now we created a simple 3D cube as our platform and had a player which was modelled as a skeleton.

Spooky Scary Skeleton

This week was mainly about animation so it was a pleasant surprise for myself since I've never really explored it apart from the good ol' days of Adobe Flash Player.

The first step was to have the skeleton change its rotation based on the direction of movement. This was done by simply forcing the rotation of the y axis to be 90 degrees.
thisTransform.eulerAngles = new Vector3(0f, 90f, 0f);

After getting to know how the animation window works and experimenting in how we can manipulate the object. We managed to get the a secondary platform to bounce back and forth smoothly so the player would be able to time their jump and make it over.

Unity's Animation window. Let's you manipulate any property of the object that has the animation component.

I found myself surprised with the capabilities of Unity's in-engine animation support as I always thought the dedicated tools for animating models/objects were always the main source for game development. A program such like Maya or Blender (which I thought was more of a modelling software than animation prior) is what I had in mind for dedicated software.
Considering Unity has an in-engine implementation for basic/moderately advanced animations. I think I'll get into learning it a bit more and max some complex animations in some upcoming projects where it can play a bit part on how polished the final result will be.

But we ran into an issue with the whole, platformer part of this game. Jumping to a moving platform was fine and all, except for the part of not sticking to said platform and simply sliding right off as if we were not on the platform at all.
But there was a simple fix for it, since any objects that have a parent are referenced to that parent, all we had to do was check when the player jumped onto the platform and change it's parent.

void OnCollisionEnter(Collision other) {  
    //Have the player's parent be the moving platform so they don't slide off it
    if(other.gameObject.tag == "MovingPlatform")
        thisTransform.parent = other.gameObject.transform;

void OnCollisionExit(Collision other) {  
    if(thisTransform.parent.tag == "MovingPlatform")
        thisTransform.parent = null;

OnCollisionExit is so when the skeleton leaves the platform, the script resets the parent so it doesn't cause unexpected behaviour later on.

The next step which happened to be the last one for the lesson was to setup animations for different actions the skeleton is currently performing. Thanks to the pre-compiled skeleton model & animations, all that was needed to be done is setup a script that handled it by dumping all the animations to use into an Animation component and play them depending on the current state.

This was my first time looking into animations and it was quite interesting. It's something that I definitely look forward to in the coming weeks and the next trimesters in Studio where we start pumping some decent games out.

Maya | Computer Animation & Modelling Software. (1998). Retrieved 26 July 2016, from (1995). Retrieved 26 July 2016, from

Tom Lynn

Read more posts by this author.