CMCharacter Modules 0.1.0

Character Motor

Kind: Character · Add Component: Character Modules > Character Motor

Moves the character at a fixed rate and lets each module take its turn. Every jump is the same on every machine, so the feel you tune is the feel players get.

The character itself: every module plugs into it. It steps the character at a fixed rate, picks which state moves it, and hands each module the same picture of the world. Because the step rate is fixed, a jump is the same height on every computer, and a recorded run plays back exactly.

Inspector
▼Character Motor⋮
Simulation
Tick Rate60
InterpolateOn ▾
World
Max Slope Angle45
Eye Height1.6
Eye Height Transition0.15
Body
Body FacingView ▾
Body Turn Rate720
Initial StateNone
The Character Motor component in the Inspector, with its defaults.
Origin. Quake (1996) moved the player with one function fed a fixed command each frame (pmove); every shooter engine since works this way. Unreal's Character Movement Component is the same idea in a modern engine.

How it works

Runs a character built from modules on the same GameObject, at a fixed step rate:

1. Command one CharacterCommand from the CommandSource

2. Sense sensors fill MotorContext.senses (ground, ...)

3. Select the state machine picks the active state (modifiers' PreTick runs just before)

4. Simulate the active state changes the velocity and fills the move request

5. Move the solver sweeps the hull and slides along what it hits

6. Resolve post-move modifiers, sense again, landing and step events

7. Publish snapshot for cameras, HUD and (later) animation

The motor is kinematic: no Rigidbody, no CharacterController. It never reads devices and never touches an Animator. Its transform is the feet position and is never rotated; the facing lives in the snapshot.

Combine it

  • Used by the presets: Arena Shooter, Competitive Shooter, Surf, Retro Platformer, Modern Platformer, Traversal Adventure, Action RPG.

Properties

PropertyDescriptionRangeDefault
Tick RateSimulation steps per second. Movement is the same at any frame rate.10 to 25060
InterpolateSmooth the rendered position between simulation steps.On
Max Slope AngleSteepest slope, in degrees, the character can stand and walk on.0 to 8945
Eye HeightEye height above the feet, used by camera rigs, metres.0 or more1.6
Eye Height TransitionSeconds the eye takes to follow a change of hull height (crouching); the collider changes at once.0 or more0.15
Body FacingWho turns the body: the camera's view, the movement, or the states.View
Body Turn RateWith Body Facing on Movement: how fast the body turns toward where it moves, degrees per second.0 or more720
Initial StateState to start in. Empty: the state machine picks one on the first step.None

Additional resources