CMCharacter Modules 0.1.0

Build a controller from scratch

A playable character needs seven modules. Everything else is a choice of genre.

The minimum

  1. Create an empty GameObject named Character and add a Character Motor.
    Character Modules > Character Motor
  2. Add a child Collision, and under it a Capsule Hull (the shape) and a Step Slide Solver (how it moves through the level).
    Character Modules > Collision > Capsule Hull
  3. Add a child Sensors with a Hull Ground Sensor, so the character knows when it stands.
    Character Modules > Collision > Hull Ground Sensor
  4. Add a child States with a Walk and an Air: the two modes every character needs.
    Character Modules > States > Walk
  5. Add a child Input with an Input System Command Source, so the player drives it.
    Character Modules > Input > Input System Command Source
  6. Add a Camera as a child, with a Third Person Orbit, and a capsule mesh with a Facing Visual so you can see it.
    Character Modules > Camera > Third Person Orbit

Each module has a Character field. Drag the Character Motor into it, or select Assign in the module's Inspector. Press Play: the character walks, falls and turns to the camera.

Inspector
▼Walk⋮
CharacterCharacter (Character Motor)
Max Speed6
Acceleration10
Friction6
Stop Speed2.5
Walk: how the character moves on the ground. Acceleration and friction decide the feel.

Give it a jump

Add a Jump under States. Then decide how forgiving it is: Coyote Time and Jump Buffering forgive late and early presses; Variable Jump Height lets a tap make a hop.

Choose a genre

To make it feel like…Add or change
an arena shooterBox Hull, First Person Rig, high Air acceleration, Bunny Hopping.
a 1990s 3D platformerHeading Walk and Heading Air instead of Walk and Air, then Jump Chain, Running Jump, Long Jump, Backflip, Side Flip, Wall Kick, Ground Pound.
a modern 3D platformerVector Air, Held Jump, Roll, Spin, Wall Slide and Wall Jump; remove Fall Damage.
a traversal adventureSprint, Mantle, Ledge Climb with Marked Ledges, Jump Assist, Dodge.
an action RPGStamina, Sprint, Dodge, Lock On.

In code

The presets are built the same way in Editor/CharacterRecipes.cs, which you can copy:

GameObject character = CharacterRecipes.CreateBase("My Character");   // motor, input, sensors, Jump, ...
CharacterRecipes.TraversalAdventure(character);                       // the genre's modules and numbers
character.GetComponentInChildren<WalkState>().maxSpeed = 7f;           // then tune

Additional resources