I’ve modified your script to allow the horizontal movement, but you should take a look at what was changed, as well as the link I’ve included on how to properly implement SimpleMove.
Instead of declaring “speed” as the movement of the player/camera, I’ve renamed it appropriately to “movement”, and removed line 36.
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class FirstPersonController : MonoBehaviour {
public float movementSpeed = 5.0f;
public float mouseSensitivity = 5.0f;
float verticalRotation = 0;
public float UpDownRange = 60.0f;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
//Rotation
float rotLeftRight = Input.GetAxis("Mouse.X") * mouseSensitivity;
transform.Rotate(0, rotLeftRight, 0);
verticalRotation -= Input.GetAxis("Mouse.Y") * mouseSensitivity;
verticalRotation = Mathf.Clamp(verticalRotation, -UpDownRange, UpDownRange);
Camera.main.transform.rotation = Quaternion.Euler(verticalRotation, 0, 0);
//Movement
float forwardSpeed = Input.GetAxis("Vertical");
float sideSpeed = Input.GetAxis("Horizontal");
Vector3 Movement= new Vector3(sideSpeed, 0, forwardSpeed);
CharacterController cc = GetComponent<CharacterController>();
cc.SimpleMove(Movement * movementSpeed);
}
}