P2 sample, using Unity’s CharacterController

Over the course of the class so far, we’ve avoided using the Character Controller, for two reasons.

  1. It is worthwhile to understand how things work, at a slightly lower level, implementing the collisions and push-back code to keep your avatar out of geometry.  In a 2D platformer, this is doable, especially when the geometry is simple.
  2. The built in controller is somewhat limiting and fixed in it’s structure.  This can be a problem for certain games.

However, as I work through building 3D sample for class, and think about P3, I’ve changed my mind on it’s for P3 and future assignments.  Problems with the controller for platformer is that uses a capsule instead of a cube for the avatar (resulting in weird behaviors at the edge of platforms), and sliding along the edge of geometry (which, you can and should control with your own collision reaction code).  But once we move into 3D, its likely your want to use that kind of collider, and with more complex geometry, you need the behaviors the controller provides.

Here’s a discussion of the reasons in favor of Character Controllers, in NVidia’s PhysX SDK Documentation (since Unity is built on PhysX, it’s likely that this discussion applies directly to Unity).

So, in addition to allowing folks to use the controller for P3, I am also posting a version of the P2 sample code here, that uses the controller:  P2-skelton-v4

Comments are closed.