Wednesday 1.6 | Ledge Grabbing

Platformer Prototype

Ledge grabbing method that doesn't require any additional colliders. (But requires every ledge to be a mesh collider)

Ledge Detection Code

I could've just made it with colliders but felt kinda special today.

  1. Shoot a rays down at differing angles (Amount and angle change controllable)
  2. If hit and surface normal points to the sky get the triangle that was hit
  3. Calculates boundaries for the triangle
  4. Calculate closest point to "hand" position within these boundaries
  5. Snap player in ledge grab pose to this point (Animations not in yet)

(Doesn't work for ledges that are not perfectly going along the x or z axis & doesn't take height into consideration yet)



White rectangle are the boundaries of the triangle, red ray is a no hit, blue hit, green hit and the normal is pointing up. White sphere is the calculated grab point. (The one attached to player is a wall check sphere)

Cleaning up

I also got rid of booleans for controlling the climbing and used an enum to control flow through the climbing process. Before I had a mess of booleans like onLedge, climbing and detectingLedge. Which was a nightmare to manage and debug.

	public enum Mode

Today's Work

On top of the above explained ledge grabbing and detection.

  • Climbing
    • Can only climb up and sideways
    • Can drop from wall when joystick back enough (Threshold controllable)
    • Can't jump to the when right next to it
    • Minor fixes

Next up are the animations which I fear are going to be a hassle.

Tuesday 31.5 | Climbing

Platformer Prototype

A bit of polishing on the roll and climbing system's code being today's main focus. Telling a little about the system and why I decided to do this kind of climbing system.

Climbing System

Fast Research & Design

The quest for climbing started with researching the ways people have made climbing mechanics in unity. Before though, I set some boundaries such as it must have very little need for animations and that the implementation has to be easy for my kinematic character controller.

Minimizing Animation Amount

I thought about how I could minimize the need for animations and thought of making the player leap across the wall. This would result in not needing to blend and sync 4 climbing animations just for the movement which might've ended being boring after all. When the player is not leaping the character slowly slips down the surface eventually falling to the ground, adding a small mechanic in avoiding falling down.


Easy Development

I found some amazing climbing tech demos, but these were not what I was looking for because of the complexity. Then after a little bit of browsing I came across a familiar site, Catlike Coding. There I found out I should just shift the gravity and project the movement input based on the wall normal, so I did. The leap and slip method helps fast development a lot too because there's no procedural animations. Now next is probably the hardest part that is the ledge detecting, grabbing and all the animation blending that come with them.

ClimberEditor GravityShiftingCode

Today's work

  • Platformer
    • Roll made a little longer
    • Climbing code
      • Detects wall at certain height and proximity
      • Player rotates to face wall normal
      • Gravity shifts to wall normal
      • "Climbable" physics layer
      • Movement input relative to wall normal
      • Leaps to direction of input
      • Slips constantly and slides off after certain time

Monday 30.5 | Roll & Air Control

3D Stealth Platformer Prototype

Today's focus has been on air control and getting the rolling animation working in unity.

Problems Implementing Roll

I wanted the roll animation to benefit from it's root motion, in hopes of making it look half decent. This meant that I would have to disable the characters movement when the roll was triggered and then enabling it after the roll had finished. So I needed to know when the animation would stop and call a function to set a boolean variable "rolling" to false, enabling the movement.


I tried doing this via Unity's animation events but had an issue where the events weren't triggering and read that it can be unreliable with transitions and such. More problems arose though as I tried implementing my own animation event system. I did this because someone had implemented a coroutine based system and I thought I'd try it out but got caught in trying to make it highly scalable which it really didn't need to be.


After getting back to Unity's animation events I realized it was the animators transition that messed with the event. This was fixed by triggering the event earlier in the animation lifetime. So what came of it was a mess and I should've just stuck with the animation events. Just another reminder to keep it simple.

Air Control & Rolling

  • Air control
    • Controllable from half influence to none
    • Character turns slower
    • Character only moves forward unlike when on ground
      • (On ground character moves exactly where joystick is pointing, rotation being a gimmick)
    • Animation events used to stop character controller movement when attacking to use root motion from the animations for precise attacking
  • Roll
    • Character horizontal movement stops to allow root motion to do its job

Sunday 29.5 | Movement

3D Stealth Platformer Prototype

This is the first daily post so I will be telling a little about where the project is right now as well as today's work.

Current state

This week I have worked on movement which needs some polishing and a whole roll mechanic before being able to move onto other things. After all the basics are in place I can start to thinking about what mechanics are still needed for fun gameplay.

  • Behaviour tree implementation with the help of this Behaviour Tree Tutorial
    • Currently the only behaviours the enemies have are chasing when they spot a player and patrolling.
  • Scivolo Character Controller as base. Scivolo Character Controller
    • Just moved from Unity's own third person controller to this one because of the added flexibility.
  • Environment from Unity's 3rd person template.
  • Animations from Mixamo. (Sword and Shield Pack)
  • Enemies and rest are from past projects of mine or from the Unity Starter Assets.
ScreenshotOfEnemyFromEditor PlayerAnimatorSimple


Today I focused on migrating away from using Unity's built-in Character Controller component. Reason being the very limited control you have over the Unity's solution and weird "physics" behaviour. For me this weird behaviour was a slowing down of the character when jumping and landing.

  • Going from unity template 3rd person to scivolo character controller
    • Extracting everything useful from template
      • Camera rotation
      • Animator and State setting from script
      • Own attack scripts moved
      • Running -> Walking -> Idle, Animation blending smoothed
      • Air control