This project is a sample of the Open Kinematic Character Controller. A Kinematic Character Controller (KCC) provides a way to control a character avatar as a kinematic object that will interact with the environment.
OpenKCC is an open source project hosted at https://github.com/nicholas-maltbie/OpenKCC
This is an open source project licensed under a MIT License. Feel free to use a build of the project for your own work. If you see an error in the project or have any suggestions, write an issue or make a pull request, I'll happy include any suggestions or ideas into the project.
You can see a demo of the project running here:
https://nickmaltbie.com/OpenKCC/.
The project hosted on the website is up to date with the most recent
version on the main
branch of this github repo
and is automatically deployed with each update to the codebase.
Make sure to add the required dependcies to your project
- com.unity.inputsystem version 1.0.0 or newer
- com.unity.textmeshpro version 3.0.0 or newer
- com.nickmaltbie.screenmanager version 3.0.0 or newer
- com.nickmaltbie.statemachineunity version 1.1.0 or newer
- com.nickmaltbie.testutilsunity version 0.0.2 or newer
In order to use the samples in the project, make sure to also add the following projects to your project.
Install the latest version of the project by importing a project via git
at this URL:
https://github.com/nicholas-maltbie/OpenKCC.git#release/latest
If you want to reference a specific tag of the project such as version v1.0.0
,
add a #release/v1.0.0
to the end of the git URL to download the package
from th auto-generated branch for that release. An example of importing v1.0.0
would look like this:
https://github.com/nicholas-maltbie/openkcc.git#release/v1.0.0
.
To use the latest release, simply reference:
https://github.com/nicholas-maltbie/openkcc.git#release/latest
For a full list of all tags, check the OpenKCC Tags list on github. I will usually associated a tag with each release of the project.
Note: before I started using the package format for the project, I manually
released a unity package you needed to import. Any version before v1.0.0
will not work to import the project.
If you do not include a tag, this means that your project will update whenever you reimport from main. This may cause some errors or problems due to experimental or breaking changes in the project.
You can also import the project via a tarball if you download the source
code and extract it on your local machine. Make sure to import
via the package manifest defined at Packages\com.nickmaltbie.openkcc\package.json
within the project.
For more details about installing a project via git, see unity's documentation on Installing form a Git URL.
If you wish to install the project via a
Scoped Registry
and npm, you can add a scoped registry to your project from all of the
com.nickmaltbie
packages like this:
"scopedRegistries": [
{
"name": "nickmaltbie",
"url": "https://registry.npmjs.org",
"scopes": [
"com.nickmaltbie"
]
}
]
Then, if you want to reference a version of the project, you simply
need to include the dependency with a version string and the unity package
manager will be able to download it from the registry at
https://registry.npmjs.org
"dependencies": {
"com.nickmaltbie.openkcc": "1.0.0",
"com.nickmaltbie.screenmanager": "3.0.0",
"com.unity.inputsystem": "1.0.2",
"com.unity.textmeshpro": "3.0.6"
}
If you wish to include the testing code for this project, make sure to add
the com.unity.inputsystem
and com.nickmaltbie.openkcc
to the testables
of the project manifest.
"testables": [
"com.unity.inputsystem",
"com.nickmaltbie.openkcc"
]
Additionally, some of the testing code uses pro builder's api, so make sure to import com.unity.probuilder version 5.0 or newer as well.
In order to run the samples from the project, you must import the following projects:
- com.unity.probuilder version 5.0 or newer
- com.unity.render-pipelines.universal version 10.0 or newer
The samples in the project include:
- ExampleFirstPersonKCC - Example first person character controller with a basic test scene.
- SimplifiedDemoKCC - Simplified character controller with basic movement scripts.
Documentation on the project and scripting API is found at https://nickmaltbie.com/OpenKCC/docs/ for the latest version of the codebase.
To view the documentation from a local build of the project install DocFX, use the following command from the root of the repo.
Documentation/build.sh
(Or this for windows)
.\Documentation\build.cmd
The documentation for the project is stored in the folder /Documentation
and can be modified and changed to update with the project.
This documentation project is inspired by the project by Norman Erwan's DocFxForUnity
I will be making a video series discussing how the Open KCC works and going into detail about how the various features work, describing game design in general, and details about the unity engine and virtual environments.
As these videos are created they will be listed here:
- Designing Character Controllers Intro
- Physics Behind Games and Character Interactions
- Projection Based Movement of KCC
- How the KCC Manages Jumping
- Camera controller and Dither Shader
- [Planned] Character Controller Case Study and Requirements Engineering
Movement in a 3D space including
- Physics based movement off dynamic surfaces
- Configurable jump and speed
- Multiplayer support
- Ground detection
- Maximum slope for walking
- Moving and rotating platforms
- Snapping up and down stairs
- Rag-doll mode
- Animation and inverse kinematics
- First and third person camera
- Adjustable camera zoom
- Fading character model
- Configurable controls
- Changing player model
- Interactable objects
Some of these features are still in the previous Falling Parkour project but will be added to the Open KCC soon.
Future improvements that are in development
- Slippery floors
- First person character model
- Ladders and vertical movement
- Climbing surfaces
- Procedural animations using inverse kinematics
- Swimming and floating in water
- Non-humanoid avatars and shapes
- Automated unit and integration testing
If you want to help with the project, feel free to make some changes and submit a PR to the repo.
This project is developed using Unity Release 2021.3.11f1. Install this version of Unity from Unity Hub using this link: unityhub://2021.3.11f1/0a5ca18544bf.
Ensure that you also have git lfs installed. It should be setup to auto-track
certain types of files as determined in the .gitattributes
file. If the
command to install git-lfs git lfs install
is giving you trouble, try
looking into the installation guide.
Once git lfs is installed, from in the repo, run the following command to pull objects for development.
git lfs pull
When working with the project, make sure to setup the .githooks
if
you want to edit the code in the project. In order to do this, use the
following command to reconfigure the core.hooksPath
for your repository
git config --local core.hooksPath .githooks