Character Controller with Gravity Modifier

I’ve started reading the Stormlight archive series by Brandon Sanderson – two books in – and it has some amazing magic system mechanisms such as Lashing and Lightweaving.

“A Basic Lashing involved revoking a being’s or object’s spiritual gravitational bond to the planet below, instead temporarily linking that being or object to a different object or direction” – from Words of Radiance by Brandon Sanderson

There are other types of lashing which allows a character to pull themselves in different directions, for e.g.. lashing towards the sky partially creates weightlessness.

I wanted to create a custom character controller using Unity C# that imitates these movement mechanics and so far I’ve got the basic lashing working. For basic movement, the class uses speed and acceleration to determine horizontal velocity and constant vertical velocity. Using gravity strength, if the player is mid-air such as when they’re jumping, vertical velocity is calculated per frame.

To rotate or modify the gravity vector, I set the target gravity vector based on player’s input and linearly interpolate from current gravity direction to target gravity and then the character’s transform vectors are reoriented.

Leave a comment