Search Unity

Free Kinematic Body - custom character controller

Discussion in 'Scripting' started by marmito, May 1, 2020.

  1. marmito

    marmito

    Joined:
    Jan 19, 2014
    Posts:
    40
    Hello! I've been reading a lot about character controllers and collision detection & response, ended up making this little project called Kinematic Body. It's just a custom character controller using a Kinematic rigidbody, running inside fixed update with interpolation and so on. I made it to be very similar to the built-in character controller. The kinematic body is able to walk up/down stairs, slopes, detect ground, react to moving obstacles and handle collision even when moving at a high speed. You should also be able to rotate it, it's not axis aligned, but you'll need to code your own ground checking. It's pretty decent IMHO, however there's some small issues, like when you walk against a crease, it will try to move away from it, seems to be related to the collide and slide implementation that I'm using, didn't figured out a way to fix it thought.

    Playable webgl demo: itch.io
    Source code: GitHub

     
  2. LenarVakhitov

    LenarVakhitov

    Joined:
    Mar 21, 2018
    Posts:
    3
    This is an invaluable find for me!!!
     
  3. trooperer

    trooperer

    Joined:
    Apr 27, 2014
    Posts:
    1
    This is awesome, I've been wanting to find out how Unity's CharacterController is implemented. This looks like a great place to start. Thanks!
     
  4. unity_dIXESLolCS_Taw

    unity_dIXESLolCS_Taw

    Joined:
    Mar 27, 2021
    Posts:
    1
    Would be very helpful if you could comment the code :)
     
  5. nottakenpliz

    nottakenpliz

    Joined:
    Jan 22, 2022
    Posts:
    1
    Hello there,
    Would it be ok if I change the code by adding loads more features to it and sell it on the asset store. If not I won’t. Cheers!
     
  6. Putcho

    Putcho

    Joined:
    Jun 1, 2013
    Posts:
    246
    always read LICENSE.txt
     
    MelvMay likes this.
  7. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    11,491
    No need to necro the thread, the license is right there in the repo that answers your question already.