Working with Animation Events in Unity

Creating an Animation event

  • In Player.cs, create a reference for LedgeChecker called activeLedge
  • In LedgeChecker.cs, create a Vector3 reference for the standPos in LedgeChecker.cs
  • In OnTriggerEnter, add a parameter this when calling GrabLedge()
  • Create a method of type Vector3 GetStandPos() to return standPos
  • Set the Player’s position to GetStandPos()
  • Place the player in the exact place where the climbUp animation finishes to get the standupPos value
  • As it will be a modular script, we need to set that value automatically. For this, you can create a reference for standPos in Player.cs and modify it in the inspector when you have found the correct position

Animation events

--

--

--

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

Recommended from Medium

How to disable zoom only in SceneKit

Changes: NFT Staking Pools, NFT Launchpad, Partnerships

CS371p Fall 2021: Jeffrey Moulckers: Final Entry

Simplify your developer life with Boop

Use SSH instead of HTTPS in cloning Github repository

READ/DOWNLOAD$% Sql Pocket Guide FULL BOOK PDF & FULL AUDIOBOOK

Linaro announces launch of 96Boards System-on-Module (SOM) Specification

AImotive Integrates RoadRunner 3D Scene Editing Capability by MathWorks into aiSim

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
Hernando Nieto Jaramillo

Hernando Nieto Jaramillo

Unity developer

More from Medium

Jumping in between two walls in Unity

Tessellation in HDRP

Loading Scenes In Unity

Adding a Main Menu to our UI