How : Player move forward automatically (global Z axis) & 'not' the direction it's facing

Hello, I’m a total beginner in using Unity & C#, and I’m just learning by myself. Can anyone help me ?

I would like to make an infinite runner game like Subway Surfers. I want my player to keep on running forward non stop. My player can also rotate and face all directions following mouse, but he then runs forward to the direction he’s facing instead. I don’t want that.

How can I make my player ignore the directions he’s facing, and just continue moving forward ?
Is it possible ?
By the way I’m using Character Controller and I don’t want to use Rigid body.

void FixedUpdate() {
transform.position += transform.forward * Time.deltaTime;
Turning ();

	void Update () {

				float horizontalAxis = Input.GetAxis ("Horizontal");
				float verticalAxis = Input.GetAxis ("Vertical");

				if (controller.isGrounded) {
					// We are grounded, so recalculate
					// move direction directly from axes        
					moveDirection = new Vector3 (0, 0, verticalAxis);

					anim.SetBool ("run", true);

					if (Input.GetKeyDown (KeyCode.UpArrow)) {
						anim.SetTrigger ("jump");
						moveDirection.y = jumpSpeed;


				// Apply gravity
				moveDirection.y -= gravity * Time.deltaTime;

				// Move the controller
				controller.Move (moveDirection * Time.deltaTime);

If you want to make it so that turning around doesn’t change the way you’re moving, you have to use Rigid body. Then you can toggle the “freeze position” option for x, y, & z (But be sure to only toggle the two you want) and remember to tune the “drag” parameter to suit your needs.

    float x;
    float y;
    private Rigidbody r;

    void Start()
        r = transform.GetComponent<Rigidbody>();
        x = transform.eulerAngles.y;

    void Update()

        x += Input.GetAxis("Horizontal"); 
        y = Input.GetAxis("Vertical");

        //turn around without changing which direction to move
        Quaternion rotation = Quaternion.Euler(0, x, 0);
        transform.rotation = rotation;

        //move forward when you press "w" or "up"
        Vector3 forward = new Vector3(0.0f, 0.0f, y);
        r.AddForce(forward * 100);

Instead of using Transform.forward use the Vector3 library:

// Keep running forward no matter rotation
transform.Translate ( Vector3.forward);

You Can use Vector3. Forward, Up and Right. If you want it Back, Down and Left just Multiply by -1:

// Keep running backward no matter rotation
    transform.Translate ( Vector3.forward * -1);

Use this as your character controller:

void Update () {
    // Will always keep running
   transform.Translate (Vector3.forward);

//Unity API Collision Function
void OnCollisionEnter (collision other) {
   /* TODO: Write Code here to Do When Your Player Hits An Object */