Climb Up With Animation Event- Game Dev Series 90

Objective: create the function of climb up from ledge with gameobject reposition.

After we successfully grabbing on the ledge, the next part we need to finish is to climb up that platform.

In this article, we will make Player climb up that platform to complete this action.

The main issue

When you download the climb up animation and import it to Player, you might notice that animation model and Player gameobject has pulled apart when the animation got played.

To make a perfect climb up action, we need to reposition the Player gameobject to where we climbed up after the motion of this animation.

Setting the animation behavior

The concept of climb up the ledge is after the animation played, Player should stand up the platform and idling.
We need to check if the climb up animation has finished playing. To do this part, we can use animation state behavior.

Select the animation in Animator, and click Add Behavior in Inspector. Create a script by giving the name on your own.

Inside this script, it would be like this.

There are 5 default method of this script. These are the methods that would proceed during this animation state.

In here we would use OnStateExit(). Get the reference of Player script as preparation.

Once we get the Player script, we can create a public method in Player to complete the climbing.

After climb up

Create a public method in Player. This would be called from Climb Up animation state. In this method, we should enable the CharacterController, and also reposition Player.

Then we need to get a new position after the motion. As we set the grabbing position in the previous article, set a new Vector3 as stand up position to Player.

Inside Ledge script, create a new Vector3 variable.

And return this position in a public method.

However, there is no reference of Ledge script in Player. We need to receive one from GrabLedge() method. Create a variable and add another requirement to GrabLedge() method.

We need to pass in the requirement in Ledge script.

Then we should be able to use the public method in Ledge to update position.

Now we can back to animation state behavior script to complete it!

All done! When Player is climbing up the platform, it should stand up at its current position!




A passionate gamer whose goal is to work in video game development.

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

Recommended from Medium

AWS Partner Network — the requirements before and after re:Invent 2018 — Get Ready Checklist

Nordic Programmers Run the World

Partial Git Commits in Android Studio (Preview)

Starter kit for apache beam

Fasten your seatbelts — May 2021

The visual representation of musical repetition in popular music.

Installation Guide of SoftEther VPN Client on Linux

Unity Integration with Github

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
S.J. Jason Liu

S.J. Jason Liu

A passionate gamer whose goal is to work in video game development.

More from Medium

Day 105: Working with Animation Events in Unity

Building A Stealth Game — Helping Your Guards “See”

2D Mobile: Designing Enemies Using Abstract Classes

Tap & Hold & Rapid Prototyping w/ New Unity Input System