# My Question Is How Do I Get My Player To Move In The Direction The Camera Is Facing?

one more thing you can do is multiply the camera’s rotation by the input as a Vector3.

if you’re not familiar with this, yes, i said rotation(Quaternion) times direction(Vector3).

Let’s assume you have an input like so:

``````Vector3 input = new Vector(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
``````

the x axis is our side to side input the z axis is our front-back input, if we use this like this for example:

``````transform.position += input;
``````

this will be relative to the global coord system, to make it relative to the local coord system you can take the object that is rotated on the Y to face the player and do

``````Vector3 input = Quaternion.Euler (0, player.transform.eulerAngles.y, 0) * new Vector(Input.GetAxis("Horizontal"), 0.0f, Input.GetAxis("Vertical"));
``````

*Quaternion must come first in multiplication with Vector3

and that makes the input axis spin to the players facing.

if the math freaks you out you could also take advantage of stuff like transform.TranformDirection to do that for you.

PS why is your code in LateUpdate rather than Update?
and what does this mean?

``````        transform.position = Target.position - (transform.forward * DistanceFromTarget);
``````

also, you’re using code tags wrong, but close enough

4 Likes