Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice

How does the CharacterController skin work?

Discussion in 'Editor & General Support' started by goldbug, Mar 12, 2012.

  1. goldbug


    Oct 12, 2011
    I am writing a game made out of voxels.

    In order to avoid creating huge mesh colliders, I rewrote my own CharacterController, with a collision detection system based on this paper.

    The whole thing works great, saves a lot of memory and time.

    However, I am getting stuck at the edges. It seems that unity has something called "Skin Width" in the character controller which somehow prevents the CharacterController from getting stuck at the edges.

    So my questions are:

    How does the skin width work?
    how is it different from simply shrinking the capsule?
    Why does it prevent the player from getting stuck at the edges?
  2. Sir-Tiddlesworth


    Oct 19, 2011
    I am honestly not sure how it works, but it is very different from shrinking the capsule.
    When you adjust the skin width the size of the capsule remains the same.
    But it does work, which is the main thing.


    Jul 4, 2012
    The skin on a capsule basically serves to allow some overlap into the capsule, while still more or less disallowing it (sort of like a mistake catcher). Think of it like a cushion to prevent objects that are going too fast from getting lodged in the collider.
  4. Zavius_Firerave


    Aug 23, 2015
    Does this skin prevent the OnCollisionEnter function to trigger? When I try it I can see that my player character's character controller collider can't touch any other collider including the ground. Do you have to attach another collider on the character so it can detect collision in the script?

    Just tried using OnControllerColliderHit(). It works but this function gets called seemingly every frame and there is no equivalent of the OnCollisionExit.
    Last edited: Nov 28, 2020
  5. ChristmasEve


    Apr 21, 2015
    I would like to know how skinwidth works too. I'm doing the exact same thing you are, with voxels, and my characters are getting stuck everywhere if they're inside somewhere (not outside traversing the terrain). It's so annoying that there is no information out there on how skin width is implemented. When people say "allows some overlap" or "allows character collider to penetrate somewhat", that tells me nothing at all. What do I do when the obstruction is within the "skin"?