Need help with basic TPS player controller

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Chevi

I have a basic character controller works but it doesn’t rotate the body mesh, like said on the title this is for a third-person shooter so you can see the player.

My goal
I want the character to rotate (relative to the camera) when it moves.
If you press left(A) the character rotates 90°(relative to the camera) then moves left (relative to the camera)

The camera moves freely around the player.

How I’m currently moving my player:

if Input.is_action_pressed("move_foward"):
	direction -= head_basis.z
elif Input.is_action_pressed("move_backward"):
	direction += head_basis.z
if Input.is_action_pressed("move_left"):
	direction -= head_basis.x
elif Input.is_action_pressed("move_right"):
	direction += head_basis.x

We can’t tell based on the information you’ve provided what direction or head_basis mean.

DDoop | 2020-07-01 21:26

var direction = Vector3()
var head_basis = head.get_global_transform().basis

I got this variable from this tutorial

Chevi | 2020-07-01 22:48