How to get the movement direction relative to a character

How do I get the movement direction of a player of a character?

Like forward, backward, left-right etc., how do I achieve this?

I can calculate movement direction relative to the world space but not relative to the character.

For example, if the character heads north, the the movement direction would be 0 degrees, if he goes south, 180 degrees etc.

But if the player was heading north with his face facing east, then the relative movement direction would be 315 degrees etc.

the local direction is

transform.forward
-transform.forward

transform.right
-transform.right

transform.up
-transform.up

those are vectors which give a direction which is 1 unit away from the objective relative to itself (so its 0,0,0)

its what your looking for

so if you’d like to move forward

character.charactercontroller.move(character.transform.forward * speed)

backward is

character.charactercontroller.move(-character.transform.forward * speed)

note the -sign

the - inverses it so -forward is backward, - right is left etc.