CMCharacter Modules 0.1.0

Heading Walk

Kind: State, ground movement role · Add Component: Character Modules > States > Heading Walk

Turns the body toward the stick and runs where it faces. The character feels like a runner, not a camera on wheels.

Moving on the ground the classic 3D platformer's way: the body turns toward the stick, and all of the speed goes along the body. Turning sharply at speed curves the path instead of sliding sideways, which makes the character feel like a runner rather than a camera on wheels.

Inspector
▼Heading Walk⋮
CharacterCharacter (Character Motor)
Max Speed6
Minimum Speed0
Start Speed2.7
Acceleration At Rest11.1
Acceleration At Top Speed3.6
Overspeed Deceleration10.1
Stop Deceleration10.1
Turn Rate337.5
Slope Start15
Slope Pull17.2
Speed Limit16.2
Walls
Wall Glance Angle30
Wall Push Speed2
Landing
Landing Time0.133
Landing Speed Kept0.55
Landing Minimum Speed1.5
The Heading Walk component in the Inspector, with its defaults.
Origin. Super Mario 64 (1996): Mario turns toward the stick and runs where he faces.

How it works

The Walking mode: runs on walkable ground.

Heading Walk: moving on the ground the way classic 3D platformers do. The character has one speed along the way its body faces, and the body turns toward the stick at a fixed rate, so a turn curves the path without losing speed. Starting off is instant up to a start speed; after that acceleration is strong when slow and weak near top speed. The stick's tilt chooses the target speed (shape it with Stick Response; the original's is a square curve). Reversing hard at speed is the Skid state. The motor's Body Facing must be States: this state turns the body.

Numbers from the classic 3D platformer study (D33; a behaviour description of the game, scaled so the hero is 1.8 m tall). Hooks called: ISpeedScale. Reads the ground's CharacterSurface for grip.

Combine it

  • Needs: Ground Sensor. The Inspector warns while one is missing.
  • Priority 10: when several states could run, the highest priority wins (see How modules combine).
  • Body facing: works with characters whose body faces States.
  • Used by the presets: Retro Platformer, Modern Platformer.

Properties

PropertyDescriptionRangeDefault
CharacterThe character this module belongs to. Drag its Character Motor here.None
Max SpeedTop running speed, m/s.0 or more6
Minimum SpeedSlowest target speed with the stick tilted at all, m/s (modern 3D platformers: about 2.3).0 or more0
Start SpeedSpeed reached at once when starting to walk from a stand, m/s.0 or more2.7
Acceleration At RestAcceleration when slow, m/s².0 or more11.1
Acceleration At Top SpeedAcceleration near top speed, m/s². Between the two it falls in a straight line with speed.0 or more3.6
Overspeed DecelerationHow fast speed above the target bleeds away on fairly flat ground, m/s².0 or more10.1
Stop DecelerationSlowing down after letting go of the stick below the skid speed, m/s².0 or more10.1
Turn RateHow fast the body turns toward the stick, degrees per second.0 or more337.5
Slope StartSlopes steeper than this pull the character downhill while walking, degrees.0 to 9015
Slope PullPull of a slope along the facing, times the sine of the slope angle, m/s².0 or more17.2
Speed LimitFastest the character can go on the ground at all, m/s.0 or more16.2
Wall Glance AngleA wall this close to the heading is slid along at full speed, degrees.0 to 9030
Wall Push SpeedRunning into a wall more head on holds the speed to this push, m/s.0 or more2
Landing TimeSeconds after landing during which the stick adds no speed.0 or more0.133
Landing Speed KeptShare of the speed kept per second during the landing with the stick held.0 to 10.55
Landing Minimum SpeedOnly a touchdown at least this fast is a landing, m/s; slower ones (stair edges) are walked through.0 or more1.5

Additional resources