First of all: If you use the FPS controller, it is bound to move you along the z and the x axes as those are the horizontal planes. That’s just how the FPS controller works.
I haven’t used it yet though so I’m asking this:
Is your character rigidbody kinematic or non kinematic ? In the first case, there is no problem. You can move your character wherever you want. In c# it should be along the lines:
void Update()
{
if(Input.GetAxis("Vertical") != 0)
{
player.transform.Translate(Vector3.up * Input.GetAxis("Vertical") * Time.deltaTime);
}
}
You can switch “Vector3.up” to the desired axis you want to translate about (Vector3.up being positive Y, Vector3.forward positive Z, Vector3.right positive X)
Be aware that those axis are always in global space. If you want to, for example, translate in the positive X direction of your character after he rotated (around his Y axis), you want to use the players right direction instead of Vector3.right, making it (yeah i switched to horizontal here, i’m sorry) :
void Update()
{
if(Input.GetAxis("Horizontal") != 0)
{
player.transform.Translate(player.transform.right * Input.GetAxis("Horizontal") * Time.deltaTime);
}
}
you can also use the cameras right direction!
void Update()
{
if(Input.GetAxis("Horizontal") != 0)
{
player.transform.Translate(Camera.main.transform.right * Input.GetAxis("Horizontal") * Time.deltaTime);
}
}
If your character is not kinematic, you basically do the same things, but instead of using .Translate, you can set the velocity directly with:
player.rigidbody.velocity = Vector3.up * Input.GetAxis("Vertical") * Time.deltaTime);
If you want to use the useGravity feature is up to what you want to make out of your game.
Hope this helped.