I need to move an object in the direction its looking but only on the X and Z axis not the Y. I am currently using:
float h = (Input.GetAxis("Horizontal") / moveScale) * sprinting;
float v = (Input.GetAxis("Vertical") / moveScale) * sprinting;
gameObject.transform.localPosition += transform.right * h;
gameObject.transform.localPosition += transform.forward * v;
And it works ok, but if my rotation is facing upwards i move up and i dont want that to happen, i just want to move horizontal.