Creating a Ledge Grab in Unity

Explaining how I implemented a ledge grab mechanic in Unity

Objective: Implement a ledge grab mechanic for my 2.5D game

In order to get all of this working today, I mainly utilized three scripts. These scripts were two C# scripts that were inherited from Monobehaviour and one C# script which was inherited from StateMachineBehaviour. The script inheriting from StateMachineBehaviour is how we can work with animation events in Unity. The script for all three scripts are below:

Code for Ledge grabbing
Code in Player class
Code to handle animation events

Linking all of this up gave me the following result:

A bit choppy, but definitely something I am happy with! Implementing this system took a lot more work than I thought, and only serves as a reminder that sometimes the things that seem small actually end up being a pretty involved task.

Thanks for reading! In the next article, I will begin finalizing my 2.5D game project.



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