0 votes

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.
e.i
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
asked Jul 1 in Engine by Chevi (35 points)

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

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

I got this variable from this tutorial

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.