How to climb stairs as a Rigidbody (in Unity3D)

Using: Unity 3D5

So you want to add some stairs to your game? Great! Adding stairs in level design adds more vertical variety to your levels. Or perhaps your game is based on stairs (Stair Climbing Simulator 2018?).

In this tutorial I’ll show you how to implement stair climbing from scratch in Unity3D if you’re using a Rigidbody as your player. Before we get to coding, you should consider your (much easier / less work) alternatives:

  1. Use a CharacterController. It already has some support for this, but can’t have physics applied willy nilly, nor is it as customizable as a Rigidbody with multiple colliders.
  2. Use a CapsuleCollider with your Rigidbody. If you get the player going fast enough they can just ram right over the stairs.
  3. Use ramps or stairs with invisible ramps over the steps. They work just as well and even provide a smooth transition surface. Doesn’t work for cases of dynamic/physics content or player generated content.
Powered by Hexo Logo Fursona by TFOTR